diff options
author | luozhengzheng <[email protected]> | 2016-10-05 09:15:57 +0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-10-04 18:15:57 -0700 |
commit | e2c292bbfc9f1133c3faa46ac88f794b64da7ce2 (patch) | |
tree | b29fec24270e4ddbde174590bdcfe930ae84e00d /cmd | |
parent | 5cc78dc81232bc474d25ccfcacb42d80d83c5310 (diff) |
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 <[email protected]>
Signed-off-by: luozhengzheng <[email protected]>
Closes #5209
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/zfs/zfs_main.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index bf9a79248..fedc1a04d 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -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); } |