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

Marius Zbihlei marius.zbihlei at 1and1.ro
Tue Aug 3 10:44:24 CEST 2010


Module: sip-router
Branch: kamailio_3.0
Commit: d82acc969092fa8f9ddcb88775c221aceaace4df
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d82acc969092fa8f9ddcb88775c221aceaace4df

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.
(cherry picked from commit 2ae7c6779188e053aa6d1cbd891c428ccc2b63fa)

---

 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 ca60e80..5ed5a65 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -1160,6 +1160,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;
 }
@@ -1390,6 +1391,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;
 }
@@ -1424,6 +1426,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;
 
 }
@@ -1481,8 +1484,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