Fix potential NULL ptr dereference, found by Coverity

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2022-05-17 14:37:06 +02:00
parent 9304024841
commit 83aa6abb1c
+3
View File
@@ -122,6 +122,9 @@ static int sulogin(int do_reboot)
for (i = 0; i < NELEMS(cmd); i++) {
char *path = which(cmd[i]);
if (!path)
continue;
if (access(path, X_OK)) {
free(path);
continue;