[sr-dev] git:3.3: modules_k/rls: Fixed memory leak in rls

Peter Dunkley peter.dunkley at crocodile-rcs.com
Mon Aug 13 16:52:47 CEST 2012


Module: sip-router
Branch: 3.3
Commit: 52f1ea5eb0067e94207dcfaa461260d96b2635bc
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=52f1ea5eb0067e94207dcfaa461260d96b2635bc

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Mon Aug 13 15:49:09 2012 +0100

modules_k/rls: Fixed memory leak in rls

- Issue fixed by Paul Pankhurst and Peter Dunkley @ Crocodile RCS
(cherry picked from commit c9628aa038ad7099a72af67f9284e5d0a9b78173)

---

 modules_k/rls/subscribe.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/modules_k/rls/subscribe.c b/modules_k/rls/subscribe.c
index 7df5d40..66c295a 100644
--- a/modules_k/rls/subscribe.c
+++ b/modules_k/rls/subscribe.c
@@ -463,6 +463,7 @@ int rls_handle_subscribe(struct sip_msg* msg, str watcher_user, str watcher_doma
 	subs_t subs;
 	pres_ev_t* event = NULL;
 	int err_ret = -1;
+	int ret = to_presence_code;
 	str* contact = NULL;
 	xmlDocPtr doc = NULL;
 	xmlNodePtr service_node = NULL;
@@ -743,6 +744,8 @@ int rls_handle_subscribe(struct sip_msg* msg, str watcher_user, str watcher_doma
 		remove_expired_rlsubs(&subs, hash_code);
 
 done:
+	ret = 1;
+forpresence:
 	if(contact!=NULL)
 	{	
 		if(contact->s!=NULL)
@@ -758,14 +761,7 @@ done:
 		xmlFreeDoc(doc);
 	if (rlsubs_did.s != NULL)
 		pkg_free(rlsubs_did.s);
-	return 1;
-
-forpresence:
-	if(subs.pres_uri.s!=NULL)
-		pkg_free(subs.pres_uri.s);
-	if (rlsubs_did.s != NULL)
-		pkg_free(rlsubs_did.s);
-	return to_presence_code;
+	return ret;
 
 bad_event:
 	err_ret = 0;




More information about the sr-dev mailing list