Module: kamailio
Branch: master
Commit: 57ee97f52dd90c86743b6fd6dd682285ef994e80
URL: 
https://github.com/kamailio/kamailio/commit/57ee97f52dd90c86743b6fd6dd682285ef994e80

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2020-09-09T15:33:18+02:00

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

---

Modified: src/core/data_lump.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/57ee97f52dd90c86743b6fd6dd682285ef994e80.diff
Patch: 
https://github.com/kamailio/kamailio/commit/57ee97f52dd90c86743b6fd6dd682285ef994e80.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;


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to