Module: sip-router
Branch: 3.3
Commit: 858e4148f222e9f448d54c6bee45a53a8def7062
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=858e414…
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;
}
}