mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 14:25:15 +00:00
prevent a double free() when re-initing the parser
This commit is contained in:
17
gram.y
17
gram.y
@@ -592,7 +592,7 @@ init_parser(path, quiet)
|
||||
int quiet;
|
||||
{
|
||||
struct defaults *d;
|
||||
struct member *m, *lastbinding;
|
||||
struct member *m, *freed;
|
||||
struct userspec *us;
|
||||
struct privilege *priv;
|
||||
struct cmndspec *cs;
|
||||
@@ -607,10 +607,14 @@ init_parser(path, quiet)
|
||||
efree(m->name);
|
||||
efree(m);
|
||||
}
|
||||
freed = NULL;
|
||||
while ((cs = lh_pop(&priv->cmndlist)) != NULL) {
|
||||
while ((m = lh_pop(&cs->runaslist)) != NULL) {
|
||||
efree(m->name);
|
||||
efree(m);
|
||||
if (lh_last(&cs->runaslist) != freed) {
|
||||
freed = lh_last(&cs->runaslist);
|
||||
while ((m = lh_pop(&cs->runaslist)) != NULL) {
|
||||
efree(m->name);
|
||||
efree(m);
|
||||
}
|
||||
}
|
||||
efree(cs->cmnd->name);
|
||||
efree(cs->cmnd);
|
||||
@@ -621,9 +625,10 @@ init_parser(path, quiet)
|
||||
}
|
||||
lh_init(&userspecs);
|
||||
|
||||
lastbinding = NULL;
|
||||
freed = NULL;
|
||||
while ((d = lh_pop(&defaults)) != NULL) {
|
||||
if (lh_pop(&d->binding) != lastbinding) {
|
||||
if (lh_last(&d->binding) != freed) {
|
||||
freed = lh_last(&d->binding);
|
||||
while ((m = lh_pop(&d->binding)) != NULL) {
|
||||
efree(m->name);
|
||||
efree(m);
|
||||
|
Reference in New Issue
Block a user