mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 11:29:36 +03:00
Fix coverity defects: CID 161638
CID 161638: Resource leak (RESOURCE_LEAK) Ensure the string array in print_zpool_script_help is freed in cases when there is an error. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov> Closes #6111
This commit is contained in:
parent
e624cd1959
commit
3e2ecae01c
@ -4131,8 +4131,11 @@ print_zpool_script_help(char *name, char *path)
|
|||||||
|
|
||||||
rc = libzfs_run_process_get_stdout_nopath(path, argv, NULL, &lines,
|
rc = libzfs_run_process_get_stdout_nopath(path, argv, NULL, &lines,
|
||||||
&lines_cnt);
|
&lines_cnt);
|
||||||
if (rc != 0 || lines == NULL || lines_cnt <= 0)
|
if (rc != 0 || lines == NULL || lines_cnt <= 0) {
|
||||||
|
if (lines != NULL)
|
||||||
|
libzfs_free_str_array(lines, lines_cnt);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < lines_cnt; i++)
|
for (int i = 0; i < lines_cnt; i++)
|
||||||
if (!is_blank_str(lines[i]))
|
if (!is_blank_str(lines[i]))
|
||||||
|
Loading…
Reference in New Issue
Block a user