2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00: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:
Steve Beattie
2013-09-11 02:10:31 -07:00
parent a1bf63dbe9
commit 93198cc7dd
3 changed files with 6 additions and 0 deletions

View File

@@ -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;
}