summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-01-13 00:50:15 +0100
committerTony Hutter <[email protected]>2022-06-06 16:57:46 -0700
commit56eed508d40207d9c45e724cb85d795ba878c575 (patch)
tree510eb389df631d8ce2de03a973cce6dc966987b6 /lib
parent271241187b180021bb63ead8c4eac6637ee412e6 (diff)
libzfs: mount: don't leak mnt_param_t if mnt_func fails
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12968
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_mount.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c
index d7c728f3f..82a67ee63 100644
--- a/lib/libzfs/libzfs_mount.c
+++ b/lib/libzfs/libzfs_mount.c
@@ -1348,7 +1348,7 @@ zfs_mount_task(void *arg)
sizeof (mountpoint), NULL, NULL, 0, B_FALSE) == 0);
if (mp->mnt_func(handles[idx], mp->mnt_data) != 0)
- return;
+ goto out;
/*
* We dispatch tasks to mount filesystems with mountpoints underneath
@@ -1369,6 +1369,8 @@ zfs_mount_task(void *arg)
zfs_dispatch_mount(mp->mnt_hdl, handles, num_handles, i,
mp->mnt_func, mp->mnt_data, mp->mnt_tp);
}
+
+out:
free(mp);
}