[sr-dev] git:5.2:aaeb0ca5: topoh: free old outbound buffer inside th_msg_sent()

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 20 12:06:06 CEST 2019


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-08-15T12:44:10+02:00

topoh: free old outbound buffer inside th_msg_sent()

- GH #2027

(cherry picked from commit 37a1765853294016f43bd633667cd623aaaa2d3e)

---

Modified: src/modules/topoh/topoh_mod.c

---

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

---

diff --git a/src/modules/topoh/topoh_mod.c b/src/modules/topoh/topoh_mod.c
index c1a597eb1e..0eb5345598 100644
--- a/src/modules/topoh/topoh_mod.c
+++ b/src/modules/topoh/topoh_mod.c
@@ -411,6 +411,7 @@ int th_msg_sent(sr_event_param_t *evp)
 	int direction;
 	int dialog;
 	int local;
+	str nbuf = STR_NULL;
 
 	obuf = (str*)evp->data;
 
@@ -497,7 +498,15 @@ int th_msg_sent(sr_event_param_t *evp)
 	}
 
 ready:
-	obuf->s = th_msg_update(&msg, (unsigned int*)&obuf->len);
+	nbuf.s = th_msg_update(&msg, (unsigned int*)&nbuf.len);
+	if(nbuf.s!=NULL) {
+		LM_DBG("new outbound buffer generated\n");
+		pkg_free(obuf->s);
+		obuf->s = nbuf.s;
+		obuf->len = nbuf.len;
+	} else {
+		LM_ERR("failed to generate new outbound buffer\n");
+	}
 
 done:
 	free_sip_msg(&msg);




More information about the sr-dev mailing list