mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix coverity defects: CID 150953, 147603, 147610
coverity scan CID:150953,type: uninitialized scalar variable coverity scan CID:147603,type: Resource leak coverity scan CID:147610,type: Resource leak Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: luozhengzheng <luo.zhengzheng@zte.com.cn> Closes #5209
This commit is contained in:
committed by
Brian Behlendorf
parent
5cc78dc812
commit
e2c292bbfc
+11
-2
@@ -6120,8 +6120,11 @@ share_mount(int op, int argc, char **argv)
|
||||
start_progress_timer();
|
||||
get_all_datasets(&dslist, &count, verbose);
|
||||
|
||||
if (count == 0)
|
||||
if (count == 0) {
|
||||
if (options != NULL)
|
||||
free(options);
|
||||
return (0);
|
||||
}
|
||||
|
||||
qsort(dslist, count, sizeof (void *), libzfs_dataset_cmp);
|
||||
|
||||
@@ -6153,8 +6156,11 @@ share_mount(int op, int argc, char **argv)
|
||||
*/
|
||||
|
||||
/* Reopen MNTTAB to prevent reading stale data from open file */
|
||||
if (freopen(MNTTAB, "r", mnttab_file) == NULL)
|
||||
if (freopen(MNTTAB, "r", mnttab_file) == NULL) {
|
||||
if (options != NULL)
|
||||
free(options);
|
||||
return (ENOENT);
|
||||
}
|
||||
|
||||
while (getmntent(mnttab_file, &entry) == 0) {
|
||||
if (strcmp(entry.mnt_fstype, MNTTYPE_ZFS) != 0 ||
|
||||
@@ -6184,6 +6190,9 @@ share_mount(int op, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (options != NULL)
|
||||
free(options);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user