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 <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #15516
This commit is contained in:
Chunwei Chen 2023-11-14 12:59:02 -08:00 committed by GitHub
parent 2319656802
commit da51bd17e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View 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); dsl_dataset_rele_flags(ds, DS_HOLD_FLAG_DECRYPT, FTAG);
} }
if (zap_clone == 0 || aff_snap_count == 0) if (zap_clone == 0 || aff_snap_count == 0) {
return (0); error = 0;
goto out;
}
/* Check clones. */ /* Check clones. */
zap_cursor_t *zc; zap_cursor_t *zc;