Module: kamailio Branch: master Commit: ad8d9628da27a3ab68b005ef52842784af6bda3a URL: https://github.com/kamailio/kamailio/commit/ad8d9628da27a3ab68b005ef52842784...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2019-08-12T11:18:08+02:00
dialog: free old outbound buffer inside SREV_NET_DATA_OUT callback
---
Modified: src/modules/dialog/dlg_cseq.c
---
Diff: https://github.com/kamailio/kamailio/commit/ad8d9628da27a3ab68b005ef52842784... Patch: https://github.com/kamailio/kamailio/commit/ad8d9628da27a3ab68b005ef52842784...
---
diff --git a/src/modules/dialog/dlg_cseq.c b/src/modules/dialog/dlg_cseq.c index 8986d0aaa6..fd993b076f 100644 --- a/src/modules/dialog/dlg_cseq.c +++ b/src/modules/dialog/dlg_cseq.c @@ -364,6 +364,7 @@ int dlg_cseq_msg_sent(sr_event_param_t *evp) struct via_body *via; hdr_field_t *hfk = NULL; sr_cfgenv_t *cenv = NULL; + str nbuf = STR_NULL;
obuf = (str*)evp->data; memset(&msg, 0, sizeof(sip_msg_t)); @@ -520,11 +521,13 @@ int dlg_cseq_msg_sent(sr_event_param_t *evp) } } /* replace old msg content */ - obuf->s = pkg_malloc((tbuf_len+1)*sizeof(char)); - if(obuf->s==NULL) { + nbuf.s = pkg_malloc((tbuf_len+1)*sizeof(char)); + if(nbuf.s==NULL) { LM_ERR("not enough memory for new message\n"); goto done; } + pkg_free(obuf->s); + obuf->s = nbuf.s; memcpy(obuf->s, tbuf, tbuf_len); obuf->s[tbuf_len] = 0; obuf->len = tbuf_len;