Skip to content

Commit da51bd1

Browse files
authored
Fix snap_obj_array memory leak in check_filesystem()
Use goto out instead of return for early exit to make sure snap_obj_array is freed. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Closes openzfs#15516
1 parent 2319656 commit da51bd1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

module/zfs/spa_errlog.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,10 @@ check_filesystem(spa_t *spa, uint64_t head_ds, zbookmark_err_phys_t *zep,
425425
dsl_dataset_rele_flags(ds, DS_HOLD_FLAG_DECRYPT, FTAG);
426426
}
427427

428-
if (zap_clone == 0 || aff_snap_count == 0)
429-
return (0);
428+
if (zap_clone == 0 || aff_snap_count == 0) {
429+
error = 0;
430+
goto out;
431+
}
430432

431433
/* Check clones. */
432434
zap_cursor_t *zc;

0 commit comments

Comments
 (0)