Module: kamailio
Branch: 5.1
Commit: 4bc686a1fbbd4a3431d327d6ecf45daf3d8e509b
URL: 
https://github.com/kamailio/kamailio/commit/4bc686a1fbbd4a3431d327d6ecf45daf3d8e509b

Author: Alex Hermann <[email protected]>
Committer: Henning Westerholt <[email protected]>
Date: 2019-02-05T21:26:28+01:00

dispatcher: Fix memleak in destination attributes

(cherry picked from commit 614b6b05028ea8d364f7acb95a6367f7c9ea1a6d)

---

Modified: src/modules/dispatcher/dispatch.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/4bc686a1fbbd4a3431d327d6ecf45daf3d8e509b.diff
Patch: 
https://github.com/kamailio/kamailio/commit/4bc686a1fbbd4a3431d327d6ecf45daf3d8e509b.patch

---

diff --git a/src/modules/dispatcher/dispatch.c 
b/src/modules/dispatcher/dispatch.c
index 7e246e577d..6377df682b 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -424,6 +424,8 @@ ds_dest_t *pack_dest(str iuri, int flags, int priority, str 
*attrs)
        if(dp != NULL) {
                if(dp->uri.s != NULL)
                        shm_free(dp->uri.s);
+               if(dp->attrs.body.s != NULL)
+                       shm_free(dp->attrs.body.s);
                shm_free(dp);
        }
 
@@ -480,6 +482,8 @@ int add_dest2list(int id, str uri, int flags, int priority, 
str *attrs,
        if(dp != NULL) {
                if(dp->uri.s != NULL)
                        shm_free(dp->uri.s);
+               if(dp->attrs.body.s != NULL)
+                       shm_free(dp->attrs.body.s);
                shm_free(dp);
        }
 
@@ -3031,6 +3035,10 @@ void ds_avl_destroy(ds_set_t **node_ptr)
                        shm_free(dest->uri.s);
                        dest->uri.s = NULL;
                }
+               if (dest->attrs.body.s != NULL) {
+                       shm_free(dest->attrs.body.s);
+                       dest->attrs.body.s = NULL;
+               }
        }
        if(node->dlist != NULL)
                shm_free(node->dlist);


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to