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 <neskovic@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4896
This commit is contained in:
Gvozden Neskovic 2016-07-28 22:10:05 +02:00 committed by Brian Behlendorf
parent 78867a0a0a
commit df053d67a9
1 changed files with 4 additions and 1 deletions

View File

@ -726,6 +726,7 @@ process_options(int argc, char **argv)
} else { } else {
(void) strlcpy(zo->zo_dir, path, (void) strlcpy(zo->zo_dir, path,
sizeof (zo->zo_dir)); sizeof (zo->zo_dir));
free(path);
} }
break; break;
case 'V': case 'V':
@ -4702,8 +4703,10 @@ ztest_zap_parallel(ztest_ds_t *zd, uint64_t id)
tx = dmu_tx_create(os); tx = dmu_tx_create(os);
dmu_tx_hold_zap(tx, object, B_TRUE, NULL); dmu_tx_hold_zap(tx, object, B_TRUE, NULL);
txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG); txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
if (txg == 0) if (txg == 0) {
umem_free(od, sizeof (ztest_od_t));
return; return;
}
bcopy(name, string_value, namelen); bcopy(name, string_value, namelen);
} else { } else {
tx = NULL; tx = NULL;