summaryrefslogtreecommitdiffstats
path: root/cmd/ztest/ztest.c
diff options
context:
space:
mode:
authorGvozden Neskovic <[email protected]>2016-07-28 22:10:05 +0200
committerBrian Behlendorf <[email protected]>2016-07-29 15:34:12 -0700
commitdf053d67a9c07a9763a4c04468083644eb9aa234 (patch)
tree32a74bc664b3d9cd0972d01404f82c1b15c1b44e /cmd/ztest/ztest.c
parent78867a0a0a47eafbf4d02ddb12a84ef86cd7a07a (diff)
ztest: memory leaks reported by AddressSanitizer
Leaks reported by using AddressSanitizer, GCC 6.1.0 Direct leak of 4097 byte(s) in 1 object(s) allocated from: #1 0x414f73 in process_options cmd/ztest/ztest.c:721 Direct leak of 5440 byte(s) in 17 object(s) allocated from: #1 0x41bfd5 in umem_alloc ../../lib/libspl/include/umem.h:88 #2 0x41bfd5 in ztest_zap_parallel cmd/ztest/ztest.c:4659 #3 0x4163a8 in ztest_execute cmd/ztest/ztest.c:5907 Signed-off-by: Gvozden Neskovic <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #4896
Diffstat (limited to 'cmd/ztest/ztest.c')
-rw-r--r--cmd/ztest/ztest.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 2cc410f10..852bf00a6 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -726,6 +726,7 @@ process_options(int argc, char **argv)
} else {
(void) strlcpy(zo->zo_dir, path,
sizeof (zo->zo_dir));
+ free(path);
}
break;
case 'V':
@@ -4702,8 +4703,10 @@ ztest_zap_parallel(ztest_ds_t *zd, uint64_t id)
tx = dmu_tx_create(os);
dmu_tx_hold_zap(tx, object, B_TRUE, NULL);
txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
- if (txg == 0)
+ if (txg == 0) {
+ umem_free(od, sizeof (ztest_od_t));
return;
+ }
bcopy(name, string_value, namelen);
} else {
tx = NULL;