zipl/src/zipl_helper.device-mapper: Fix bug in error path

Prevent double free/close that happens in get_multipath_status()
when the output of "dmsetup status XXX" is empty

Fixes: 599b141 ("zipl: Rewrite helper script in C")
Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Eduard Shishkin
2022-11-02 14:26:24 +01:00
committed by Jan Höppner
parent 7b369318dd
commit 10cefb3337

View File

@@ -611,9 +611,6 @@ static struct util_list *get_multipath_status(const char *devname)
}
}
free(line);
pclose(fp);
len = util_list_len(status);
if (len == 0) {
ERR("No paths found for '%s'\n", devname);
@@ -625,15 +622,14 @@ static struct util_list *get_multipath_status(const char *devname)
WARN("There are one or more failed paths for device '%s'\n",
devname);
}
return status;
out:
goto success;
out:
status_list_free(status);
status = NULL;
success:
free(line);
pclose(fp);
status_list_free(status);
return NULL;
return status;
}
static struct util_list *get_multipath_data(const char *devname, char *args)