Skip to content

Commit

Permalink
Fix memory leak in ztest
Browse files Browse the repository at this point in the history
This is tripping LeakSanitizer, which causes zloop test failures on pull
requests.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes openzfs#14583
  • Loading branch information
ryao authored Mar 6, 2023
1 parent b79e711 commit bc4d210
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/ztest.c
Original file line number Diff line number Diff line change
Expand Up @@ -4639,8 +4639,11 @@ ztest_dmu_object_alloc_free(ztest_ds_t *zd, uint64_t id)
* Destroy the previous batch of objects, create a new batch,
* and do some I/O on the new objects.
*/
if (ztest_object_init(zd, od, size, B_TRUE) != 0)
if (ztest_object_init(zd, od, size, B_TRUE) != 0) {
zd->zd_od = NULL;
umem_free(od, size);
return;
}

while (ztest_random(4 * batchsize) != 0)
ztest_io(zd, od[ztest_random(batchsize)].od_object,
Expand Down

0 comments on commit bc4d210

Please sign in to comment.