From aaeb0ca500f4cbf98631c58da5289eea30b3dd92 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Mon, 12 Aug 2019 11:16:23 +0200 Subject: [PATCH] topoh: free old outbound buffer inside th_msg_sent() - GH #2027 (cherry picked from commit 37a1765853294016f43bd633667cd623aaaa2d3e) --- src/modules/topoh/topoh_mod.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/topoh/topoh_mod.c b/src/modules/topoh/topoh_mod.c index c1a597eb1ea..0eb53455980 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);