]> git.proxmox.com Git - mirror_zfs.git/commitdiff
libzfs: mount: don't leak mnt_param_t if mnt_func fails
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Wed, 12 Jan 2022 23:50:15 +0000 (00:50 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 2 Feb 2022 00:57:16 +0000 (16:57 -0800)
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12968

lib/libzfs/libzfs_mount.c

index 3c35c0ed0793c519083f1bc730299b7f03ed3fbc..0932cb1de6f0b8d8d00af61dd6ae5aa4f2b0dd02 100644 (file)
@@ -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);
 }