Module: kamailio
Branch: master
Commit: d9a1cbc8f66f9fd0991048e5e1ba1579916a092e
URL:
https://github.com/kamailio/kamailio/commit/d9a1cbc8f66f9fd0991048e5e1ba157…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-08-12T11:18:21+02:00
gzcompress: free old outbound buffer inside SREV_NET_DATA_OUT callback
---
Modified: src/modules/gzcompress/gzcompress_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d9a1cbc8f66f9fd0991048e5e1ba157…
Patch:
https://github.com/kamailio/kamailio/commit/d9a1cbc8f66f9fd0991048e5e1ba157…
---
diff --git a/src/modules/gzcompress/gzcompress_mod.c
b/src/modules/gzcompress/gzcompress_mod.c
index 3e06c1c267..3ff22d723d 100644
--- a/src/modules/gzcompress/gzcompress_mod.c
+++ b/src/modules/gzcompress/gzcompress_mod.c
@@ -338,6 +338,7 @@ int gzc_msg_sent(sr_event_param_t *evp)
unsigned long olen;
unsigned long nlen;
int ret;
+ str nbuf = STR_NULL;
obuf = (str*)evp->data;
memset(&msg, 0, sizeof(sip_msg_t));
@@ -383,7 +384,15 @@ int gzc_msg_sent(sr_event_param_t *evp)
goto done;
}
- obuf->s = gzc_msg_update(&msg, (unsigned int*)&obuf->len);
+ nbuf.s = gzc_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);