[sr-dev] git:master:614b6b05: dispatcher: Fix memleak in destination attributes

Henning Westerholt henningw at users.noreply.github.com
Tue Feb 5 21:11:08 CET 2019


Module: kamailio
Branch: master
Commit: 614b6b05028ea8d364f7acb95a6367f7c9ea1a6d
URL: https://github.com/kamailio/kamailio/commit/614b6b05028ea8d364f7acb95a6367f7c9ea1a6d

Author: Alex Hermann <alex at hexla.nl>
Committer: Henning Westerholt <henningw at users.noreply.github.com>
Date: 2019-02-05T21:11:03+01:00

dispatcher: Fix memleak in destination attributes

---

Modified: src/modules/dispatcher/dispatch.c

---

Diff:  https://github.com/kamailio/kamailio/commit/614b6b05028ea8d364f7acb95a6367f7c9ea1a6d.diff
Patch: https://github.com/kamailio/kamailio/commit/614b6b05028ea8d364f7acb95a6367f7c9ea1a6d.patch

---

diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 4956623cc7..072869010e 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -461,6 +461,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);
 	}
 
@@ -517,6 +519,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);
 	}
 
@@ -3306,6 +3310,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