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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
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);


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

Reply via email to