diff --git a/plugins/sudoers/toke.c b/plugins/sudoers/toke.c index 535c264c5..608b39aa1 100644 --- a/plugins/sudoers/toke.c +++ b/plugins/sudoers/toke.c @@ -3355,6 +3355,7 @@ switch_dir(struct include_stack *stack, char *dirpath) } if (stat(path, &sb) != 0 || !S_ISREG(sb.st_mode)) { efree(path); + path = NULL; continue; } pl = malloc(sizeof(*pl)); diff --git a/plugins/sudoers/toke.l b/plugins/sudoers/toke.l index f2c4f48f8..22e852da5 100644 --- a/plugins/sudoers/toke.l +++ b/plugins/sudoers/toke.l @@ -656,6 +656,7 @@ switch_dir(struct include_stack *stack, char *dirpath) } if (stat(path, &sb) != 0 || !S_ISREG(sb.st_mode)) { efree(path); + path = NULL; continue; } pl = malloc(sizeof(*pl));