mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Fix a double free bug in include handling
This commit is contained in:
parent
7d3a95c797
commit
a92114480c
1 changed files with 9 additions and 6 deletions
|
@ -359,15 +359,18 @@ static int process_include(char *inc, char *name, int line, FILE *out, int nest)
|
|||
|
||||
if (*inc == '\"') {
|
||||
buf = strdup(inc + 1);
|
||||
newf = fopen(buf, "r");
|
||||
if (buf)
|
||||
newf = fopen(buf, "r");
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < npath; i++) {
|
||||
asprintf(&buf, "%s/%s", path[i], inc + 1);
|
||||
newf = fopen(buf, "r");
|
||||
if (newf)
|
||||
break;
|
||||
free(buf);
|
||||
if (asprintf(&buf, "%s/%s", path[i], inc + 1) != -1) {
|
||||
newf = fopen(buf, "r");
|
||||
if (newf)
|
||||
break;
|
||||
free(buf);
|
||||
}
|
||||
buf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue