Module: kamailio
Branch: master
Commit: 21816a11a56628a9eee17765645fcf03d57929bd
URL:
https://github.com/kamailio/kamailio/commit/21816a11a56628a9eee17765645fcf0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-08-12T11:17:33+02:00
topos: free old outbound buffer inside SREV_NET_DATA_OUT callback
- GH #2027
---
Modified: src/modules/topos/topos_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/21816a11a56628a9eee17765645fcf0…
Patch:
https://github.com/kamailio/kamailio/commit/21816a11a56628a9eee17765645fcf0…
---
diff --git a/src/modules/topos/topos_mod.c b/src/modules/topos/topos_mod.c
index f6b6a3a2f5..942c545d58 100644
--- a/src/modules/topos/topos_mod.c
+++ b/src/modules/topos/topos_mod.c
@@ -390,6 +390,7 @@ int tps_msg_sent(sr_event_param_t *evp)
str *obuf;
int dialog;
int local;
+ str nbuf = STR_NULL;
obuf = (str*)evp->data;
@@ -443,7 +444,15 @@ int tps_msg_sent(sr_event_param_t *evp)
tps_response_sent(&msg);
}
- obuf->s = tps_msg_update(&msg, (unsigned int*)&obuf->len);
+ nbuf.s = tps_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);