[sr-dev] git:4.2:74888e44: core: remove_lump() clears its innner before/after lists

Daniel-Constantin Mierla miconda at gmail.com
Thu Jan 15 20:21:19 CET 2015


Module: kamailio
Branch: 4.2
Commit: 74888e44aa4db53a3e8db49d848af97d460f7e1f
URL: https://github.com/kamailio/kamailio/commit/74888e44aa4db53a3e8db49d848af97d460f7e1f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-01-15T20:14:41+01:00

core: remove_lump() clears its innner before/after lists

- fixing leak issues that could be created by using sl_forward_reply()
  in config file

(cherry picked from commit 1fd0ca99eaa4b2c5cfcb8bd555a35088ddf49343)

---

Modified: data_lump.c

---

Diff:  https://github.com/kamailio/kamailio/commit/74888e44aa4db53a3e8db49d848af97d460f7e1f.diff
Patch: https://github.com/kamailio/kamailio/commit/74888e44aa4db53a3e8db49d848af97d460f7e1f.patch

---

diff --git a/data_lump.c b/data_lump.c
index 5faee6f..6beb93f 100644
--- a/data_lump.c
+++ b/data_lump.c
@@ -709,6 +709,11 @@ unsigned int count_applied_lumps(struct lump *ll, int type)
 	return n;
 }
 
+/**
+ * remove a lump in a root list
+ * - it doesn't look for lumps added as before/after rule
+ * - destroys the entire lump, with associated before/after rules
+ */
 int remove_lump(sip_msg_t *msg, struct lump *l)
 {
 	struct lump *t = NULL;
@@ -733,7 +738,9 @@ int remove_lump(sip_msg_t *msg, struct lump *l)
 		} else {
 			prev->next = t->next;
 		}
-		free_lump(t);
+		/* detach and free all its content */
+		t->next = NULL;
+		free_lump_list(t);
 		return 1;
 	}
 	return 0;




More information about the sr-dev mailing list