[sr-dev] git:master:7ae1384c: kazoo: avoid WARNING:qm_free: free(0) when kamailio shuts down on config parsing errors

Ovidiu Sas osas at voipembedded.com
Wed Jan 25 17:08:51 CET 2017


In the past, there were some distros that were crashing on free(0).
It shouldn't be a problem now ...
If there are no objections from other developers, go ahead and remove
the warning from qm_free.
Or maybe turn it into a debug probe.

Regards,
Ovidiu Sas

On Wed, Jan 25, 2017 at 4:27 AM, Alekzander Spiridonov
<sipidronov at gmail.com> wrote:
> Since it's safe to free(0) in general I do believe that proper fix would be
> to not warn in qm_free.
>
> 2017-01-24 20:36 GMT+03:00 Ovidiu Sas <osas at voipembedded.com>:
>>
>> Module: kamailio
>> Branch: master
>> Commit: 7ae1384c7b944b4f6d49ad7deb5586cc4e397882
>> URL:
>> https://github.com/kamailio/kamailio/commit/7ae1384c7b944b4f6d49ad7deb5586cc4e397882
>>
>> Author: Ovidiu Sas <osas at voipembedded.com>
>> Committer: Ovidiu Sas <osas at voipembedded.com>
>> Date: 2017-01-24T12:33:54-05:00
>>
>> kazoo: avoid WARNING:qm_free: free(0) when kamailio shuts down on config
>> parsing errors
>>
>> ---
>>
>> Modified: src/modules/kazoo/kazoo.c
>> Modified: src/modules/kazoo/kz_amqp.c
>>
>> ---
>>
>> Diff:
>> https://github.com/kamailio/kamailio/commit/7ae1384c7b944b4f6d49ad7deb5586cc4e397882.diff
>> Patch:
>> https://github.com/kamailio/kamailio/commit/7ae1384c7b944b4f6d49ad7deb5586cc4e397882.patch
>>
>> ---
>>
>> diff --git a/src/modules/kazoo/kazoo.c b/src/modules/kazoo/kazoo.c
>> index 7d4b03e..8c44391 100644
>> --- a/src/modules/kazoo/kazoo.c
>> +++ b/src/modules/kazoo/kazoo.c
>> @@ -463,8 +463,8 @@ static int fire_init_event(int rank)
>>
>>  static void mod_destroy(void) {
>>         kz_amqp_destroy();
>> -    shm_free(kz_worker_pipes_fds);
>> -    shm_free(kz_worker_pipes);
>> +    if (kz_worker_pipes_fds) { shm_free(kz_worker_pipes_fds); }
>> +    if (kz_worker_pipes) { shm_free(kz_worker_pipes); }
>>  }
>>
>>
>> diff --git a/src/modules/kazoo/kz_amqp.c b/src/modules/kazoo/kz_amqp.c
>> index 9c802aa..2111e89 100644
>> --- a/src/modules/kazoo/kz_amqp.c
>> +++ b/src/modules/kazoo/kz_amqp.c
>> @@ -604,7 +604,7 @@ kz_amqp_server_ptr
>> kz_amqp_destroy_server(kz_amqp_server_ptr server_ptr)
>>      kz_amqp_server_ptr next = server_ptr->next;
>>         kz_amqp_destroy_connection(server_ptr->connection);
>>         kz_amqp_destroy_channels(server_ptr);
>> -       shm_free(server_ptr->producer);
>> +       if (server_ptr->producer) { shm_free(server_ptr->producer); }
>>         shm_free(server_ptr);
>>         return next;
>>  }
>>
>>
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>
>
>
> --
> Best regards,
> Alekzander Spiridonov
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>



-- 
VoIP Embedded, Inc.
http://www.voipembedded.com



More information about the sr-dev mailing list