Commit 93198cc7 authored by Steve Beattie's avatar Steve Beattie

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's avatarSteve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks's avatarTyler Hicks <tyhicks@canonical.com>
parent a1bf63db
......@@ -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; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment