diff options
author | Richard Yao <[email protected]> | 2023-03-06 18:30:29 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2023-03-06 15:30:29 -0800 |
commit | bc4d210783686a0b6728546576e4465912f99afc (patch) | |
tree | a72a1b5f6e37b7ae6028e731b331fdca09c0114a /cmd/ztest.c | |
parent | b79e7114bb95862ebe6d98f0ac9692cae7798d17 (diff) |
Fix memory leak in ztest
This is tripping LeakSanitizer, which causes zloop test failures on pull
requests.
Reviewed-by: Tino Reichardt <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #14583
Diffstat (limited to 'cmd/ztest.c')
-rw-r--r-- | cmd/ztest.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/ztest.c b/cmd/ztest.c index 790835363..fb9f83032 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -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, |