Fix two memory use errors detected by ASAN
Fix two memory use errors detected by ASAN: a task in lifesci-single-cell-spatial-swe-envs-nocap (Harbor dataset). Title: Fix two memory use errors detected by ASAN
The task
**Title:** Fix two memory use errors detected by ASAN
Part of scalingX/lifesci-single-cell-spatial-swe-envs-nocap.