Module: kamailio
Branch: 5.2
Commit: bbac07207f55216ece4fad4d1aed2ed578cb0e15
URL:
https://github.com/kamailio/kamailio/commit/bbac07207f55216ece4fad4d1aed2ed…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-08-15T12:44:22+02:00
topos: free old outbound buffer inside SREV_NET_DATA_OUT callback
- GH #2027
(cherry picked from commit 21816a11a56628a9eee17765645fcf03d57929bd)
---
Modified: src/modules/topos/topos_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bbac07207f55216ece4fad4d1aed2ed…
Patch:
https://github.com/kamailio/kamailio/commit/bbac07207f55216ece4fad4d1aed2ed…
---
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);