mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Subject: parser - fix memory leaks identified by valgrind tests
This patch fixes a few memory leaks found by valgrind. Most of these occur in error cases and as such, are not a big deal. The dbus TOK_MODE and flags TOK_CONDID leaks in parser_yacc.y are legitimate leaks, if of very small amounts of memory. Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: Tyler Hicks <tyhicks@canonical.com>
This commit is contained in:
parent
a1bf63dbe9
commit
93198cc7dd
3 changed files with 6 additions and 0 deletions
|
@ -111,6 +111,7 @@ static int process_file_entries(struct codomain *cod)
|
|||
PERROR(_("profile %s: has merged rule %s with "
|
||||
"conflicting x modifiers\n"),
|
||||
cod->name, cur->name);
|
||||
free(table);
|
||||
return 0;
|
||||
}
|
||||
//if (next->audit)
|
||||
|
|
|
@ -399,6 +399,7 @@ static int __expand_variable(struct symtab *symbol)
|
|||
PERROR("Variable @{%s} is referenced recursively (by @{%s})\n",
|
||||
split->var, symbol->var_name);
|
||||
retval = 1;
|
||||
free_values(this_value);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -407,12 +408,14 @@ static int __expand_variable(struct symtab *symbol)
|
|||
PERROR("Variable @{%s} references undefined variable @{%s}\n",
|
||||
symbol->var_name, split->var);
|
||||
retval = 3;
|
||||
free_values(this_value);
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = __expand_variable(ref);
|
||||
if (rc != 0) {
|
||||
retval = rc;
|
||||
free_values(this_value);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -436,6 +436,7 @@ opt_flags: { /* nothing */ $$ = 0; }
|
|||
{
|
||||
if (strcmp($1, "flags") != 0)
|
||||
yyerror("expected flags= got %s=", $1);
|
||||
free($1);
|
||||
$$ = 1;
|
||||
}
|
||||
|
||||
|
@ -1210,6 +1211,7 @@ dbus_perm: TOK_VALUE
|
|||
| TOK_MODE
|
||||
{
|
||||
parse_dbus_mode($1, &$$, 1);
|
||||
free($1);
|
||||
}
|
||||
|
||||
dbus_perms: { /* nothing */ $$ = 0; }
|
||||
|
|
Loading…
Add table
Reference in a new issue