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@voipembedded.com>:
Module: kamailio
Branch: master
Commit: 7ae1384c7b944b4f6d49ad7deb5586cc4e397882
URL: https://github.com/kamailio/kamailio/commit/7ae1384c7b944b4f6d49ad7deb5586cc4e397882

Author: Ovidiu Sas <osas@voipembedded.com>
Committer: Ovidiu Sas <osas@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@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev



--
Best regards,
Alekzander Spiridonov