mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-04 08:15:15 +00:00
Fix newly introduced use after frees found by llvm checker.
This commit is contained in:
@@ -826,15 +826,15 @@ store_mode(char *val, struct sudo_defs_types *def, int op)
|
|||||||
static void
|
static void
|
||||||
list_op(char *val, size_t len, struct sudo_defs_types *def, enum list_ops op)
|
list_op(char *val, size_t len, struct sudo_defs_types *def, enum list_ops op)
|
||||||
{
|
{
|
||||||
struct list_member *tmp, *cur, *prev = NULL;
|
struct list_member *cur, *prev = NULL;
|
||||||
debug_decl(list_op, SUDO_DEBUG_DEFAULTS)
|
debug_decl(list_op, SUDO_DEBUG_DEFAULTS)
|
||||||
|
|
||||||
if (op == freeall) {
|
if (op == freeall) {
|
||||||
SLIST_FOREACH_SAFE(cur, &def->sd_un.list, entries, tmp) {
|
while ((cur = SLIST_FIRST(&def->sd_un.list)) != NULL) {
|
||||||
efree(tmp->value);
|
SLIST_REMOVE_HEAD(&def->sd_un.list, entries);
|
||||||
efree(tmp);
|
efree(cur->value);
|
||||||
|
efree(cur);
|
||||||
}
|
}
|
||||||
SLIST_INIT(&def->sd_un.list);
|
|
||||||
debug_return;
|
debug_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user