From: Swen Schillig Date: Mon, 5 Aug 2019 09:15:59 +0000 (+0200) Subject: torture: fix mem leak found by ASAN (smb2_scan) X-Git-Tag: tdb-1.4.2~174 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dbf26d7e0c9b46ff3b8da7af0d51080bbf17a9d6;p=thirdparty%2Fsamba.git torture: fix mem leak found by ASAN (smb2_scan) Direct leak of 96 byte(s) in 1 object(s) allocated from: #0 0x7f63e6938c08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08) #1 0x7f63e615fa5c in __talloc_with_prefix ../../lib/talloc/talloc.c:782 #2 0x7f63e615fa5c in __talloc ../../lib/talloc/talloc.c:824 #3 0x7f63e615fa5c in _talloc_named_const ../../lib/talloc/talloc.c:981 #4 0x7f63e615fa5c in talloc_named_const ../../lib/talloc/talloc.c:1748 #5 0x55609e7530cf in torture_smb2_scan ../../source4/torture/smb2/scan.c:203 #6 0x7f63e2a37772 in wrap_simple_test ../../lib/torture/torture.c:633 #7 0x7f63e2a3b75e in internal_torture_run_test ../../lib/torture/torture.c:442 #8 0x7f63e2a3c543 in torture_run_tcase_restricted ../../lib/torture/torture.c:507 #9 0x7f63e2a3cdd5 in torture_run_suite_restricted ../../lib/torture/torture.c:357 #10 0x7f63e2a3cf25 in torture_run_suite_restricted ../../lib/torture/torture.c:362 #11 0x7f63e2a3d434 in torture_run_suite ../../lib/torture/torture.c:339 #12 0x55609e3a154a in run_matching ../../source4/torture/smbtorture.c:93 #13 0x55609e3a2f56 in torture_run_named_tests ../../source4/torture/smbtorture.c:143 #14 0x55609e3a699d in main ../../source4/torture/smbtorture.c:691 #15 0x7f63dad59412 in __libc_start_main (/lib64/libc.so.6+0x24412) Signed-off-by: Swen Schillig Reviewed-by: Matthias Dieter Wallnöfer Reviewed-by: Andrew Bartlett --- diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c index 3e43b9dfa32..adb7fdb7f1a 100644 --- a/source4/torture/smb2/scan.c +++ b/source4/torture/smb2/scan.c @@ -200,7 +200,7 @@ static bool torture_smb2_find_scan(struct torture_context *tctx) */ static bool torture_smb2_scan(struct torture_context *tctx) { - TALLOC_CTX *mem_ctx = talloc_new(NULL); + TALLOC_CTX *mem_ctx = talloc_new(tctx); struct smb2_tree *tree; const char *host = torture_setting_string(tctx, "host", NULL); const char *share = torture_setting_string(tctx, "share", NULL);