Add garbage collection to the sudoers parser to clean up on error.

This makes it possible to avoid memory leaks when there is a parse error.
This commit is contained in:
Todd C. Miller
2021-02-01 15:06:20 -07:00
parent 4cd6350cad
commit 9ed14870c6
8 changed files with 1202 additions and 441 deletions

View File

@@ -136,11 +136,11 @@ alias_add(struct sudoers_parse_tree *parse_tree, char *name, int type,
HLTQ_TO_TAILQ(&a->members, members, entries);
switch (rbinsert(parse_tree->aliases, a, NULL)) {
case 1:
alias_free(a);
free(a);
errno = EEXIST;
debug_return_bool(false);
case -1:
alias_free(a);
free(a);
debug_return_bool(false);
}
debug_return_bool(true);