torture: fix mem leak found by ASAN (smb2_scan)
authorSwen Schillig <swen@linux.ibm.com>
Mon, 5 Aug 2019 09:15:59 +0000 (11:15 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 10 Aug 2019 19:24:29 +0000 (19:24 +0000)
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 <swen@linux.ibm.com>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/torture/smb2/scan.c

index 3e43b9d..adb7fdb 100644 (file)
@@ -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);