aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zfs/zfs_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/zfs/zfs_main.c')
-rw-r--r--cmd/zfs/zfs_main.c13
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);
}