Skip to content

Commit 0bb41ed

Browse files
committed
Set command_info to NULL once it is freed
The lack of setting to NULL is a holdover from when command_info was a local variable and not a global one. However, we given how other global variables are set to NULL, it is best that we do the same here to avoid potential issues should sudoers_policy_store_result be called again after the first time failed, otherwise we could get a double-free.
1 parent 676066e commit 0bb41ed

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

plugins/sudoers/policy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,7 @@ sudoers_policy_store_result(bool accepted, char *argv[], char *envp[],
10541054
while (info_len--)
10551055
free(command_info[info_len]);
10561056
free(command_info);
1057+
command_info = NULL;
10571058
debug_return_bool(false);
10581059
}
10591060

0 commit comments

Comments
 (0)