mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
* fix another small memory leak in #include handling
* more code formatting changes because I'm a jerk whose mental lexer needs whitespace to properly tokenize code.
This commit is contained in:
parent
5a8a692628
commit
1b069745b3
2 changed files with 11 additions and 6 deletions
|
@ -218,8 +218,10 @@ FILE *search_path(char *filename, char **fullpath)
|
|||
exit(1);
|
||||
}
|
||||
newf = fopen(buf, "r");
|
||||
if (newf && fullpath) *fullpath = buf;
|
||||
else free(buf);
|
||||
if (newf && fullpath)
|
||||
*fullpath = buf;
|
||||
else
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
if (newf)
|
||||
break;
|
||||
|
|
|
@ -147,6 +147,9 @@ void include_filename(char *filename, int search)
|
|||
free(dirent_path);
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
if (fullpath)
|
||||
free(fullpath);
|
||||
}
|
||||
|
||||
%}
|
||||
|
@ -202,16 +205,16 @@ LT_EQUAL <=
|
|||
{WS}+ { /* Eat whitespace */ }
|
||||
\<([^\> \t\n]+)\> { /* <filename> */
|
||||
char *filename = strdup(yytext);
|
||||
filename[strlen(filename)-1]='\0';
|
||||
include_filename(filename+1, 1);
|
||||
filename[strlen(filename) - 1] = '\0';
|
||||
include_filename(filename + 1, 1);
|
||||
free(filename);
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
|
||||
\"([^\" \t\n]+)\" { /* "filename" */
|
||||
char *filename = strdup(yytext);
|
||||
filename[strlen(filename)-1]='\0';
|
||||
include_filename(filename+1, 0);
|
||||
filename[strlen(filename) - 1] = '\0';
|
||||
include_filename(filename + 1, 0);
|
||||
free(filename);
|
||||
BEGIN(INITIAL);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue