From 3c617c79211659e42039477102646a03a7bfd5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 13 Jan 2022 00:50:15 +0100 Subject: [PATCH] libzfs: mount: don't leak mnt_param_t if mnt_func fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #12968 --- lib/libzfs/libzfs_mount.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index 3c35c0ed0..0932cb1de 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -1352,7 +1352,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 @@ -1373,6 +1373,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); }