[lttng-dev] [PATCH lttng-tools] Fix: free previous instance of url (alloc_url) on default live url assignation

Jonathan Rajotte Julien Jonathan.rajotte-julien at efficios.com
Mon Dec 12 21:36:23 UTC 2016



On 2016-12-12 04:24 PM, Philippe Proulx wrote:
> On Mon, Dec 12, 2016 at 4:16 PM, Jonathan Rajotte
> <jonathan.rajotte-julien at efficios.com> wrote:
>> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
>> ---
>>   src/bin/lttng/commands/create.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c
>> index 0f7d1a4..e6f15c7 100644
>> --- a/src/bin/lttng/commands/create.c
>> +++ b/src/bin/lttng/commands/create.c
>> @@ -342,6 +342,12 @@ static int create_session(void)
>>
>>          /* Use default live URL if NO url is/are found. */
>>          if ((opt_live_timer && !opt_url) && (opt_live_timer && !opt_data_url)) {
>> +               /* Override the url */
>> +               if (url) {
>> +                       free(url);
>> +                       url = NULL;
>> +               }
> Just:

Sire, you are quite right.

>
> +               free(url);
> +               url = NULL;
>
> if the project's coding style allows.
>
> Phil
>
>> +
>>                  ret = asprintf(&alloc_url, "net://127.0.0.1");
>>                  if (ret < 0) {
>>                          PERROR("asprintf default live URL");
>> --
>> 2.7.4
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev at lists.lttng.org
>> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Jonathan R. Julien
Efficios



More information about the lttng-dev mailing list