]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix snap_obj_array memory leak in check_filesystem()
authorChunwei Chen <tuxoko@gmail.com>
Tue, 14 Nov 2023 20:59:02 +0000 (12:59 -0800)
committerGitHub <noreply@github.com>
Tue, 14 Nov 2023 20:59:02 +0000 (12:59 -0800)
Use goto out instead of return for early exit to make sure
snap_obj_array is freed.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #15516

module/zfs/spa_errlog.c

index 5dd08f597f338f0086e99691074e404d19cabcb8..244b4d26421292ed903bb2429942a504b9f63a29 100644 (file)
@@ -425,8 +425,10 @@ check_filesystem(spa_t *spa, uint64_t head_ds, zbookmark_err_phys_t *zep,
                dsl_dataset_rele_flags(ds, DS_HOLD_FLAG_DECRYPT, FTAG);
        }
 
-       if (zap_clone == 0 || aff_snap_count == 0)
-               return (0);
+       if (zap_clone == 0 || aff_snap_count == 0) {
+               error = 0;
+               goto out;
+       }
 
        /* Check clones. */
        zap_cursor_t *zc;