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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2019-08-15T12:44:54+02:00

corex: free old outbound buffer inside SREV_NET_DATA_OUT callback

(cherry picked from commit c79dfbeab0bfefaa4dd5cefc41cba3ba157da0ce)

---

Modified: src/modules/corex/corex_nio.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/9b6d1e9ee767e2bf2a31dcf817558566d99f81b2.diff
Patch: 
https://github.com/kamailio/kamailio/commit/9b6d1e9ee767e2bf2a31dcf817558566d99f81b2.patch

---

diff --git a/src/modules/corex/corex_nio.c b/src/modules/corex/corex_nio.c
index 96837e8a0c..6b79fcc648 100644
--- a/src/modules/corex/corex_nio.c
+++ b/src/modules/corex/corex_nio.c
@@ -141,6 +141,7 @@ int nio_msg_sent(sr_event_param_t *evp)
     int_str avp_value;
     struct usr_avp *avp;
     struct run_act_ctx ra_ctx;
+    str nbuf = STR_NULL;
 
     obuf = (str*)evp->data;
 
@@ -163,7 +164,15 @@ int nio_msg_sent(sr_event_param_t *evp)
         if(avp!=NULL && is_avp_str_val(avp)) {
             msg.buf = avp_value.s.s;
             msg.len = avp_value.s.len;
-            obuf->s = nio_msg_update(&msg, (unsigned int*)&obuf->len);
+            nbuf.s = nio_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");
+                       }
         } else {
             LM_WARN("no value set for AVP %.*s, using unmodified message\n",
                 nio_msg_avp_param.len, nio_msg_avp_param.s);


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

Reply via email to