[sr-dev] git:5.2:cd797dbf: dispatcher: Fix memleak in destination attributes

Henning Westerholt hw at kamailio.org
Tue Feb 5 21:29:14 CET 2019


Module: kamailio
Branch: 5.2
Commit: cd797dbfdc0c8a27cde66f096c5d592d880d65d8
URL: https://github.com/kamailio/kamailio/commit/cd797dbfdc0c8a27cde66f096c5d592d880d65d8

Author: Alex Hermann <alex at hexla.nl>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2019-02-05T21:26:24+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/cd797dbfdc0c8a27cde66f096c5d592d880d65d8.diff
Patch: https://github.com/kamailio/kamailio/commit/cd797dbfdc0c8a27cde66f096c5d592d880d65d8.patch

---

diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 621aca823a..62ad80afa5 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -446,6 +446,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);
 	}
 
@@ -502,6 +504,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);
 	}
 
@@ -3242,6 +3246,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);




More information about the sr-dev mailing list