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

Peter Dunkley peter.dunkley at crocodile-rcs.com
Wed Apr 18 18:36:45 CEST 2012


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

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Wed Apr 18 17:15:10 2012 +0100

modules_k/rls: Fixed memory leak

- The pkg memory allocated for route-sets when sendin NOTIFY requests
  was never freed.
- Fixed by Paul Pankhurst @ Crocodile RCS

---

 modules_k/rls/notify.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/modules_k/rls/notify.c b/modules_k/rls/notify.c
index 02e22ae..d4d0247 100644
--- a/modules_k/rls/notify.c
+++ b/modules_k/rls/notify.c
@@ -719,11 +719,22 @@ error:
 	return NULL;
 
 }
+
 void rls_free_td(dlg_t* td)
 {
-		pkg_free(td->loc_uri.s);
-		pkg_free(td->rem_uri.s);
+	if(td)
+	{
+		if(td->loc_uri.s)
+			pkg_free(td->loc_uri.s);
+	
+		if(td->rem_uri.s)
+			pkg_free(td->rem_uri.s);
+
+		if(td->route_set)
+			pkg_free(td->route_set); 
+
 		pkg_free(td);
+	}	
 }
 
 int rls_send_notify(subs_t* subs, str* body, char* start_cid,
@@ -880,15 +891,7 @@ dlg_t* rls_notify_dlg(subs_t* subs)
 	return td;
 
 error:
-	if(td)
-	{
-		if(td->loc_uri.s)
-			pkg_free(td->loc_uri.s);
-	
-		if(td->rem_uri.s)
-			pkg_free(td->rem_uri.s);
-		pkg_free(td);
-	}	
+	if(td) rls_free_td(td);	
 
 	return NULL;
 




More information about the sr-dev mailing list