summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvenaas <venaas>2008-05-14 13:29:41 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-05-14 13:29:41 +0000
commit348d6b01c9ba8585f94bd5c8f71c8525cd3f98b0 (patch)
treeeab7abcac6177d39f070e1e1a2c8f4d8f3b745c5
parent52ac7dae87f8fa168921c33eb8cce2813e1b408e (diff)
removed benign memory leak in addrewrite
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@257 e88ac4ed-0b26-0410-9574-a7f39faa03bf
-rw-r--r--radsecproxy.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index 7401028..33f4673 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -2820,9 +2820,12 @@ void addrewrite(char *value, char **attrs, char **vattrs) {
if (!a)
debugx(1, DBG_ERR, "malloc failed");
- for (i = 0; i < n; i++)
+ for (i = 0; i < n; i++) {
if (!(a[i] = attrname2val(attrs[i])))
debugx(1, DBG_ERR, "addrewrite: invalid attribute %s", attrs[i]);
+ free(attrs[i]);
+ }
+ free(attrs);
a[i] = 0;
}
@@ -2833,9 +2836,12 @@ void addrewrite(char *value, char **attrs, char **vattrs) {
if (!va)
debugx(1, DBG_ERR, "malloc failed");
- for (p = va, i = 0; i < n; i++, p += 2)
+ for (p = va, i = 0; i < n; i++, p += 2) {
if (!vattrname2val(vattrs[i], p, p + 1))
debugx(1, DBG_ERR, "addrewrite: invalid vendor attribute %s", vattrs[i]);
+ free(vattrs[i]);
+ }
+ free(vattrs);
*p = 0;
}
@@ -3037,8 +3043,6 @@ void confrewrite_cb(struct gconffile **cf, char *block, char *opt, char *val) {
NULL
);
addrewrite(val, attrs, vattrs);
- free(attrs);
- free(vattrs);
}
void getmainconfig(const char *configfile) {