Skip to content

Commit 669a26e

Browse files
tuxoko0mp
authored andcommitted
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 (cherry picked from commit da51bd1)
1 parent d575bc5 commit 669a26e

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
@@ -424,8 +424,10 @@ check_filesystem(spa_t *spa, uint64_t head_ds, zbookmark_err_phys_t *zep,
424424
dsl_dataset_rele_flags(ds, DS_HOLD_FLAG_DECRYPT, FTAG);
425425
}
426426

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

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

0 commit comments

Comments
 (0)