s4:torture:raw: fix 'Conditional jump or move' valgrind error.
authorNoel Power <noel.power@suse.com>
Mon, 18 Apr 2016 16:37:57 +0000 (17:37 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 25 Apr 2016 08:35:15 +0000 (10:35 +0200)
smbtorture test raw.bench-tcon.bench-tcon produces the following valgrind
trace

==32163== Conditional jump or move depends on uninitialised value(s)
==32163==    at 0x1F9D61: rate_convert_secs (tconrate.c:149)
==32163==    by 0x1FA04C: torture_bench_treeconnect (tconrate.c:189)
==32163==    by 0x9553F62: wrap_simple_test (torture.c:632)
==32163==    by 0x955368F: internal_torture_run_test (torture.c:442)
==32163==    by 0x9553A6B: torture_run_test_restricted (torture.c:542)
==32163==    by 0x260121: run_matching (smbtorture.c:110)
==32163==    by 0x25FFE3: run_matching (smbtorture.c:95)
==32163==    by 0x260242: torture_run_named_tests (smbtorture.c:143)
==32163==    by 0x261EC1: main (smbtorture.c:665)
==32163==
==32163== Use of uninitialised value of size 8
==32163==    at 0xFB0B0BB: _itoa_word (in /lib64/libc-2.19.so)
==32163==    by 0xFB0EAD2: vfprintf (in /lib64/libc-2.19.so)
==32163==    by 0xFB15598: printf (in /lib64/libc-2.19.so)
==32163==    by 0x1FA064: torture_bench_treeconnect (tconrate.c:188)
==32163==    by 0x9553F62: wrap_simple_test (torture.c:632)
==32163==    by 0x955368F: internal_torture_run_test (torture.c:442)
==32163==    by 0x9553A6B: torture_run_test_restricted (torture.c:542)
==32163==    by 0x260121: run_matching (smbtorture.c:110)
==32163==    by 0x25FFE3: run_matching (smbtorture.c:95)
==32163==    by 0x260242: torture_run_named_tests (smbtorture.c:143)
==32163==    by 0x261EC1: main (smbtorture.c:665)

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/torture/raw/tconrate.c

index 6673f11eb5cf23c196ee42dc0161537b57308f6e..ae7d544f9272e868ebe19b55058c705aa16ec34e 100644 (file)
@@ -161,7 +161,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_array(NULL, int, nprocs);
+       int *last_counts = talloc_zero_array(NULL, int, nprocs);
 
        struct timeval now, last, start;
        int i, delta;