torture: fix mem leak found by ASAN
authorSwen Schillig <swen@linux.ibm.com>
Mon, 5 Aug 2019 09:07:53 +0000 (11:07 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 10 Aug 2019 19:24:29 +0000 (19:24 +0000)
==14507==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7f3c76fe5c08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08)
    #1 0x7f3c7680df33 in __talloc_with_prefix ../../lib/talloc/talloc.c:782
    #2 0x7f3c7680df33 in __talloc ../../lib/talloc/talloc.c:824
    #3 0x7f3c7680df33 in _talloc_named_const ../../lib/talloc/talloc.c:981
    #4 0x7f3c7680df33 in _talloc_zero ../../lib/talloc/talloc.c:2422
    #5 0x7f3c7680e2a5 in _talloc_zero_array ../../lib/talloc/talloc.c:2775
    #6 0x557a50d4a09f in torture_bench_treeconnect ../../source4/torture/raw/tconrate.c:165
    #7 0x7f3c730e4772 in wrap_simple_test ../../lib/torture/torture.c:633
    #8 0x7f3c730e875e in internal_torture_run_test ../../lib/torture/torture.c:442
    #9 0x7f3c730e9543 in torture_run_tcase_restricted ../../lib/torture/torture.c:507
    #10 0x7f3c730e9dd5 in torture_run_suite_restricted ../../lib/torture/torture.c:357
    #11 0x7f3c730ea434 in torture_run_suite ../../lib/torture/torture.c:339
    #12 0x557a50c1b54a in run_matching ../../source4/torture/smbtorture.c:93
    #13 0x557a50c1cf56 in torture_run_named_tests ../../source4/torture/smbtorture.c:143
    #14 0x557a50c2099d in main ../../source4/torture/smbtorture.c:691
    #15 0x7f3c6b406412 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/raw/tconrate.c

index b485ccd8e63ce34459b7aa89b34f03eb2716da9e..3872a9cd8dae770f51d5f26beab18ced204debe7 100644 (file)
@@ -162,7 +162,7 @@ bool torture_bench_treeconnect(struct torture_context *tctx)
        int nprocs = torture_setting_int(tctx, "nprocs", 4);
 
        int *curr_counts = map_count_buffer(nprocs, sizeof(int));
-       int *last_counts = talloc_zero_array(NULL, int, nprocs);
+       int *last_counts = talloc_zero_array(tctx, int, nprocs);
 
        struct timeval now, last, start;
        int i, delta;