Commit 348d6b01 authored by venaas's avatar venaas Committed by venaas
Browse files

removed benign memory leak in addrewrite

git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@257 e88ac4ed-0b26-0410-9574-a7f39faa03bf
parent 52ac7dae
......@@ -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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment