Is this needed for 4.2 as well?
/O
On 09 Dec 2014, at 20:06, Hugh Waite <hugh.waite(a)acision.com> wrote:
Module: sip-router
Branch: master
Commit: 56c880120c07443eceb732117f0f1aa3558dcfe5
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=56c8801…
Author: Hugh Waite <hugh.waite(a)acision.com>
Committer: Hugh Waite <hugh.waite(a)acision.com>
Date: Tue Dec 9 19:05:31 2014 +0000
registrar: Fix memory leak around path and outbound header parsing
- Fix leak or parsed URI and URI parameter during a call to save()
---
modules/registrar/path.c | 10 ++--------
modules/registrar/save.c | 6 +++++-
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/modules/registrar/path.c b/modules/registrar/path.c
index 9f9ed38..0e242e3 100644
--- a/modules/registrar/path.c
+++ b/modules/registrar/path.c
@@ -96,6 +96,8 @@ int build_path_vector(struct sip_msg *_m, str *path, str *received)
LM_ERR("failed to parse parameters of first hop\n");
goto error;
}
+ /* Not interested in param body - just the hooks */
+ free_params(params);
if (hooks.contact.received) {
uri_str.s = uri_buf;
@@ -107,14 +109,6 @@ int build_path_vector(struct sip_msg *_m, str *path, str *received)
*received = uri_str;
LM_DBG("received is <%.*s>\n", received->len, received->s);
}
-
- /*for (;params; params = params->next) {
- if (params->type == P_RECEIVED) {
- *received = hooks.contact.received->body;
- break;
- }
- }*/
- free_params(params);
}
free_rr(&route);
}
diff --git a/modules/registrar/save.c b/modules/registrar/save.c
index 89a97f6..a3a5b29 100644
--- a/modules/registrar/save.c
+++ b/modules/registrar/save.c
@@ -923,17 +923,21 @@ int save(struct sip_msg* _m, udomain_t* _d, int _cflags, str
*_uri)
}
if (parse_uri(route->nameaddr.uri.s, route->nameaddr.uri.len, &puri) < 0)
{
LM_ERR("Failed to parse Path: URI\n");
+ free_rr(&route);
goto error;
}
if (parse_params(&puri.params, CLASS_URI, &hooks, ¶ms) != 0) {
LM_ERR("Failed to parse Path: URI parameters\n");
+ free_rr(&route);
goto error;
}
+ /* Not interested in param body - just the hooks */
+ free_params(params);
if (!hooks.uri.ob) {
/* No ;ob parameter to top Path: URI - no outbound */
use_ob = 0;
}
-
+ free_rr(&route);
} else {
/* No Path: header - no outbound */
use_ob = 0;
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev