[sr-dev] git:5.2:916110d5: core: skip abort() in free_lump() for LUMPFLAG_DUPED

Henning Westerholt hw at skalatan.de
Wed Sep 9 16:43:11 CEST 2020


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

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

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/916110d55a1ec83e142bd5fc2e9df8f9a5505eca.diff
Patch: https://github.com/kamailio/kamailio/commit/916110d55a1ec83e142bd5fc2e9df8f9a5505eca.patch

---

diff --git a/src/core/data_lump.c b/src/core/data_lump.c
index 6417bee21a..83d04eca8a 100644
--- a/src/core/data_lump.c
+++ b/src/core/data_lump.c
@@ -452,14 +452,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