mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 14:55:10 +00:00
Fix a double free bug in include handling
This commit is contained in:
@@ -359,15 +359,18 @@ static int process_include(char *inc, char *name, int line, FILE *out, int nest)
|
|||||||
|
|
||||||
if (*inc == '\"') {
|
if (*inc == '\"') {
|
||||||
buf = strdup(inc + 1);
|
buf = strdup(inc + 1);
|
||||||
newf = fopen(buf, "r");
|
if (buf)
|
||||||
|
newf = fopen(buf, "r");
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < npath; i++) {
|
for (i = 0; i < npath; i++) {
|
||||||
asprintf(&buf, "%s/%s", path[i], inc + 1);
|
if (asprintf(&buf, "%s/%s", path[i], inc + 1) != -1) {
|
||||||
newf = fopen(buf, "r");
|
newf = fopen(buf, "r");
|
||||||
if (newf)
|
if (newf)
|
||||||
break;
|
break;
|
||||||
free(buf);
|
free(buf);
|
||||||
|
}
|
||||||
|
buf = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user