[sr-dev] git:master: modules/tm: Fixed memory leak related to several tm function exports

Marius Zbihlei marius.zbihlei at 1and1.ro
Mon Aug 2 16:30:40 CEST 2010


Module: sip-router
Branch: master
Commit: 2ae7c6779188e053aa6d1cbd891c428ccc2b63fa
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2ae7c6779188e053aa6d1cbd891c428ccc2b63fa

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Mon Aug  2 17:26:20 2010 +0300

modules/tm: Fixed memory leak related to several tm function exports

Mk_proxy() call allocates a new proxy_t* structure. The free_proxy() call does
not free this structure, it frees only the content. Another pkg_free is necessary
in this case.

---

 modules/tm/tm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/modules/tm/tm.c b/modules/tm/tm.c
index 8f2d136..a7edc62 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -1189,6 +1189,7 @@ inline static int w_t_forward_nonack_to( struct sip_msg  *p_msg ,
 	if (proxy) {
 		r = _w_t_forward_nonack(p_msg, proxy, proxy->proto);		
 		free_proxy(proxy);
+		pkg_free(proxy);
 	}
 	return r;
 }
@@ -1441,6 +1442,7 @@ inline static int w_t_relay_to_avp( struct sip_msg  *p_msg ,
 	if (proxy) {
 		r = _w_t_relay_to(p_msg, proxy, PROTO_NONE);
 		free_proxy(proxy);
+		pkg_free(proxy);
 	}
 	return r;
 }
@@ -1475,6 +1477,7 @@ inline static int w_t_replicate_uri(struct sip_msg  *msg ,
 
 	r = t_replicate(msg, proxy, proxy->proto);
 	free_proxy(proxy);
+	pkg_free(proxy);
 	return r;
 
 }
@@ -1532,8 +1535,9 @@ inline static int w_t_replicate_to( struct sip_msg  *p_msg ,
 	int r = -1;
 	proxy = t_protoaddr2proxy(proto_par, addr_par);
 	if (proxy) {
-		r = t_replicate(p_msg, proxy, proxy->proto);		
+		r = t_replicate(p_msg, proxy, proxy->proto);
 		free_proxy(proxy);
+		pkg_free(proxy);
 	}
 	return r;
 }




More information about the sr-dev mailing list