[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] [PATCH] Make the test_libgps program more useful by allow
From: |
Robert Norris |
Subject: |
Re: [gpsd-dev] [PATCH] Make the test_libgps program more useful by allowing to specify the server and port. |
Date: |
Tue, 23 Feb 2016 21:25:46 +0000 |
----------------------------------------
> From: address@hidden
> To: address@hidden
> Date: Sun, 21 Feb 2016 23:28:45 +0000
> Subject: Re: [gpsd-dev] [PATCH] Make the test_libgps program more useful by
> allowing to specify the server and port.
>
>
> ---------------------------------------
>> To: address@hidden
>> From: address@hidden
>> Date: Sun, 21 Feb 2016 22:14:49 +0100
>> Subject: Re: [gpsd-dev] [PATCH] Make the test_libgps program more useful by
>> allowing to specify the server and port.
>>
>> On 21.02.16 20:05, Robert Norris wrote:
>>> + case 'f':
>>> + forwardmode = true;
>>> + fmsg = strdup(optarg);
>>> + break;
>>
>> Should fmsg not be freed at the end?
>>
>> Beat
>>
>> --
>
> It should be freed. Good spot.
>
> Patch now with free() included for free!
>
Third time lucky.
After some further thought, I don't think the optarg needs to be memory copied
at all, just simply a pointer reference assignment so it's now fmsg = optarg
Then nothing needs to be freed.
This is perhaps more in the general ethos of gpsd to avoid memory copying.
binoTxYdr3o_Q.bin
Description: Binary data