Module: sip-router
Branch: master
Commit: 28978be4d825e08a455387209af6dda4aa4bdfde
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=28978be…
Author: Charles Chance <charles.chance(a)sipcentric.com>
Committer: Charles Chance <charles.chance(a)sipcentric.com>
Date: Fri Oct 4 18:40:42 2013 +0100
dmq: fix memory leak in dmq_send_message()
---
modules/dmq/dmq_funcs.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/modules/dmq/dmq_funcs.c b/modules/dmq/dmq_funcs.c
index cacf89f..df17fb9 100644
--- a/modules/dmq/dmq_funcs.c
+++ b/modules/dmq/dmq_funcs.c
@@ -166,7 +166,7 @@ int dmq_send_message(dmq_peer_t* peer, str* body, dmq_node_t* node,
{
uac_req_t uac_r;
str str_hdr = {0, 0};
- str from, to, req_uri;
+ str from, to;
dmq_cback_param_t* cb_param = NULL;
int result = 0;
int len = 0;
@@ -199,11 +199,10 @@ int dmq_send_message(dmq_peer_t* peer, str* body, dmq_node_t* node,
LM_ERR("error building to string\n");
goto error;
}
- req_uri = to;
set_uac_req(&uac_r, &dmq_request_method, &str_hdr, body, NULL,
TMCB_LOCAL_COMPLETED, dmq_tm_callback, (void*)cb_param);
- result = tmb.t_request(&uac_r, &req_uri,
+ result = tmb.t_request(&uac_r, &to,
&to, &from,
NULL);
if(result < 0) {
@@ -211,9 +210,15 @@ int dmq_send_message(dmq_peer_t* peer, str* body, dmq_node_t* node,
goto error;
}
pkg_free(str_hdr.s);
+ pkg_free(from.s);
+ pkg_free(to.s);
return 0;
error:
pkg_free(str_hdr.s);
+ if (from.s!=NULL)
+ pkg_free(from.s);
+ if (to.s!=NULL)
+ pkg_free(to.s);
return -1;
}