浏览代码

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)
Marius Zbihlei 15 年之前
父节点
当前提交
d82acc9690
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      modules/tm/tm.c

+ 5 - 1
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;
 }