Module: kamailio
Branch: master
Commit: 8cd0f0be8bda6a903eab8c0ef610cb00b8ba8359
URL:
https://github.com/kamailio/kamailio/commit/8cd0f0be8bda6a903eab8c0ef610cb0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-03-21T12:28:47+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
---
Modified: src/modules/siptrace/siptrace.c
---
Diff:
https://github.com/kamailio/kamailio/commit/8cd0f0be8bda6a903eab8c0ef610cb0…
Patch:
https://github.com/kamailio/kamailio/commit/8cd0f0be8bda6a903eab8c0ef610cb0…
---
diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index fbddf23..c4b1076 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -1619,19 +1619,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);
@@ -1647,6 +1637,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)