torture: fix mem leak found by ASAN (smb2_connect)
authorSwen Schillig <swen@linux.ibm.com>
Mon, 5 Aug 2019 09:19:49 +0000 (11:19 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 21 Aug 2019 15:42:43 +0000 (15:42 +0000)
Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x7f0b16624c08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08)
    #1 0x7f0b15e4ba5c in __talloc_with_prefix ../../lib/talloc/talloc.c:782
    #2 0x7f0b15e4ba5c in __talloc ../../lib/talloc/talloc.c:824
    #3 0x7f0b15e4ba5c in _talloc_named_const ../../lib/talloc/talloc.c:981
    #4 0x7f0b15e4ba5c in talloc_named_const ../../lib/talloc/talloc.c:1748
    #5 0x55ffdd30d591 in torture_smb2_connect ../../source4/torture/smb2/connect.c:199
    #6 0x7f0b12723772 in wrap_simple_test ../../lib/torture/torture.c:633
    #7 0x7f0b1272775e in internal_torture_run_test ../../lib/torture/torture.c:442
    #8 0x7f0b12728543 in torture_run_tcase_restricted ../../lib/torture/torture.c:507
    #9 0x7f0b12728dd5 in torture_run_suite_restricted ../../lib/torture/torture.c:357
    #10 0x7f0b12729434 in torture_run_suite ../../lib/torture/torture.c:339
    #11 0x55ffdd10c54a in run_matching ../../source4/torture/smbtorture.c:93
    #12 0x55ffdd10df56 in torture_run_named_tests ../../source4/torture/smbtorture.c:143
    #13 0x55ffdd11199d in main ../../source4/torture/smbtorture.c:691
    #14 0x7f0b0aa45412 in __libc_start_main (/lib64/libc.so.6+0x24412)

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Aug 21 15:42:43 UTC 2019 on sn-devel-184

source4/torture/smb2/connect.c

index ecb4871026ec97761470c8dd4f99606039b7d6a7..5a2b48b0cbb9ed930adb1942a5aff12a0f89ce10 100644 (file)
@@ -196,7 +196,7 @@ NTSTATUS torture_smb2_createfile(struct torture_context *tctx,
 */
 bool torture_smb2_connect(struct torture_context *tctx)
 {
-       TALLOC_CTX *mem_ctx = talloc_new(NULL);
+       TALLOC_CTX *mem_ctx = talloc_new(tctx);
        struct smb2_tree *tree;
        struct smb2_request *req;
        struct smb2_handle h1, h2;