Module: kamailio
Branch: 5.0
Commit: 97c6e811814e85b9845993a6b41994f70c57d2c4
URL:
https://github.com/kamailio/kamailio/commit/97c6e811814e85b9845993a6b41994f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-03-21T13:16:20+01:00
siptrace: avoid creating proxy structure twice in trace_send_duplicate()
- can happen when dst parameter is given, resulting in mem leak
- related to GH #1040
(cherry picked from commit 8cd0f0be8bda6a903eab8c0ef610cb00b8ba8359)
---
Modified: src/modules/siptrace/siptrace.c
---
Diff:
https://github.com/kamailio/kamailio/commit/97c6e811814e85b9845993a6b41994f…
Patch:
https://github.com/kamailio/kamailio/commit/97c6e811814e85b9845993a6b41994f…
---
diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index cfe281d..dae72d7 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -1617,19 +1617,9 @@ static int trace_send_duplicate(char *buf, int len, struct
dest_info *dst2)
return 0;
init_dest_info(&dst);
- /* create a temporary proxy*/
- dst.proto = PROTO_UDP;
- p=mk_proxy(&dup_uri->host, (dup_uri->port_no)?dup_uri->port_no:SIP_PORT,
- dst.proto);
- if (p==0)
- {
- LM_ERR("bad host name in uri\n");
- return -1;
- }
if (!dst2){
- init_dest_info(&dst);
- /* create a temporary proxy*/
+ /* create a temporary proxy from dst param */
dst.proto = PROTO_UDP;
p=mk_proxy(&dup_uri->host, (dup_uri->port_no)?dup_uri->port_no:SIP_PORT,
dst.proto);
@@ -1645,6 +1635,16 @@ static int trace_send_duplicate(char *buf, int len, struct
dest_info *dst2)
" listening socket\n", dst.to.s.sa_family, dst.proto);
goto error;
}
+ } else {
+ /* create a temporary proxy to dup uri */
+ dst.proto = PROTO_UDP;
+ p=mk_proxy(&dup_uri->host, (dup_uri->port_no)?dup_uri->port_no:SIP_PORT,
+ dst.proto);
+ if (p==0)
+ {
+ LM_ERR("bad host name in uri\n");
+ return -1;
+ }
}
if (msg_send((dst2)?dst2:&dst, buf, len)<0)