Module: kamailio
Branch: master
Commit: 37a1765853294016f43bd633667cd623aaaa2d3e
URL:
https://github.com/kamailio/kamailio/commit/37a1765853294016f43bd633667cd62…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-08-12T11:16:23+02:00
topoh: free old outbound buffer inside th_msg_sent()
- GH #2027
---
Modified: src/modules/topoh/topoh_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/37a1765853294016f43bd633667cd62…
Patch:
https://github.com/kamailio/kamailio/commit/37a1765853294016f43bd633667cd62…
---
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);