Module: sip-router
Branch: 3.2
Commit: 203b10340dcf1ba34a1fe8ad6ae588c1341c0083
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=203b103…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)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
(cherry picked from commit 1b87bac8d5c56909ee4ae10f88dd8c6292b53e8a)
---
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 4a0e9b3..8cf8b0e 100644
--- a/modules_k/rls/notify.c
+++ b/modules_k/rls/notify.c
@@ -714,11 +714,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,
@@ -875,15 +886,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;