Module: sip-router
Branch: master
Commit: 5154c90b60d54ad6c993eacaadea29740c12e82b
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5154c90…
Author: Richard Fuchs <rfuchs(a)sipwise.com>
Committer: Richard Fuchs <rfuchs(a)sipwise.com>
Date: Wed Nov 7 09:12:33 2012 -0500
modules_k/siputils: Fix memory leak in uri_param() function
---
modules_k/siputils/checks.c | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/modules_k/siputils/checks.c b/modules_k/siputils/checks.c
index 6bbb72f..9794c9d 100644
--- a/modules_k/siputils/checks.c
+++ b/modules_k/siputils/checks.c
@@ -168,7 +168,7 @@ int uri_param_2(struct sip_msg* _msg, char* _param, char* _value)
str *param, *value, t;
param_hooks_t hooks;
- param_t* params;
+ param_t* params, *pit;
param = (str*)_param;
value = (str*)_value;
@@ -185,25 +185,23 @@ int uri_param_2(struct sip_msg* _msg, char* _param, char* _value)
return -1;
}
- while (params) {
- if ((params->name.len == param->len) &&
- (strncmp(params->name.s, param->s, param->len) == 0)) {
+ for (pit = params; pit; pit = pit->next) {
+ if ((pit->name.len == param->len) &&
+ (strncmp(pit->name.s, param->s, param->len) == 0)) {
if (value) {
- if ((value->len == params->body.len) &&
- strncmp(value->s, params->body.s, value->len) == 0) {
+ if ((value->len == pit->body.len) &&
+ strncmp(value->s, pit->body.s, value->len) == 0) {
goto ok;
} else {
goto nok;
}
} else {
- if (params->body.len > 0) {
+ if (pit->body.len > 0) {
goto nok;
} else {
goto ok;
}
}
- } else {
- params = params->next;
}
}