[sr-dev] git:5.4:2ca2232b: core: skip abort() in free_lump() for LUMPFLAG_DUPED

Henning Westerholt hw at skalatan.de
Wed Sep 9 16:42:54 CEST 2020


Module: kamailio
Branch: 5.4
Commit: 2ca2232b3cac72f7c03b37ef9db5a198462e6dfa
URL: https://github.com/kamailio/kamailio/commit/2ca2232b3cac72f7c03b37ef9db5a198462e6dfa

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-09-09T14:42:40Z

core: skip abort() in free_lump() for LUMPFLAG_DUPED

- the LUMPFLAG_DUPED is set when duplicating lumps list for branch route
execution, but some functions such as set_body() may want to clean them
- report and minimal reproducing config by Henning Westerholt

(cherry picked from commit 57ee97f52dd90c86743b6fd6dd682285ef994e80)

---

Modified: src/core/data_lump.c

---

Diff:  https://github.com/kamailio/kamailio/commit/2ca2232b3cac72f7c03b37ef9db5a198462e6dfa.diff
Patch: https://github.com/kamailio/kamailio/commit/2ca2232b3cac72f7c03b37ef9db5a198462e6dfa.patch

---

diff --git a/src/core/data_lump.c b/src/core/data_lump.c
index 765dd5f988..a9a4880199 100644
--- a/src/core/data_lump.c
+++ b/src/core/data_lump.c
@@ -456,14 +456,17 @@ struct lump* anchor_lump2(struct sip_msg* msg, int offset, int len,
 }
 
 
+/**
+ * free lump content
+ */
 void free_lump(struct lump* lmp)
 {
-	if (lmp && (lmp->op==LUMP_ADD)){
-		if (lmp->u.value){
-			if (lmp->flags &(LUMPFLAG_DUPED|LUMPFLAG_SHMEM)){
+	if (lmp && (lmp->op==LUMP_ADD)) {
+		if (lmp->u.value) {
+			if (lmp->flags & LUMPFLAG_SHMEM) {
 				LM_CRIT("non free-able lump: %p flags=%x\n", lmp, lmp->flags);
 				abort();
-			}else{
+			} else if(!(lmp->flags & LUMPFLAG_DUPED)) {
 				pkg_free(lmp->u.value);
 				lmp->u.value=0;
 				lmp->len=0;




More information about the sr-dev mailing list