test: fix uninitialized memory warning, use calloc
Fixes the following valgrind warning: ==29019== Syscall param writev(vector[...]) points to uninitialised byte(s) ==29019== at 0x584270B: writev (writev.c:51) ==29019== by 0x449BB2: uv__write (stream.c:733) ==29019== by 0x44AE91: uv_write2 (stream.c:1159) ==29019== by 0x44AF25: uv_write (stream.c:1180) ==29019== by 0x42CCAA: connect_cb (test-tcp-writealot.c:129) ==29019== by 0x44AC05: uv__stream_connect (stream.c:1097) ==29019== by 0x44AA25: uv__stream_io (stream.c:1050) ==29019== by 0x437430: uv__io_rw (core.c:539) ==29019== by 0x43C3D9: ev_invoke_pending (ev.c:2145) ==29019== by 0x436EC5: uv__poll (core.c:260) ==29019== by 0x436F0F: uv__run (core.c:269) ==29019== by 0x436F6E: uv_run (core.c:277) ==29019== Address 0x5f15040 is 0 bytes inside a block of size 94,371,840 alloc'd ==29019== at 0x4C2C5EF: malloc (vg_replace_malloc.c:270) ==29019== by 0x42CDED: run_test_tcp_writealot (test-tcp-writealot.c:148) ==29019== by 0x406551: run_test_part (runner.c:302) ==29019== by 0x405384: main (run-tests.c:57)
This commit is contained in:
parent
c666b6310d
commit
b88f8b40d6
@ -145,7 +145,7 @@ TEST_IMPL(tcp_writealot) {
|
||||
uv_tcp_t client;
|
||||
int r;
|
||||
|
||||
send_buffer = malloc(TOTAL_BYTES);
|
||||
send_buffer = calloc(1, TOTAL_BYTES);
|
||||
ASSERT(send_buffer != NULL);
|
||||
|
||||
r = uv_tcp_init(uv_default_loop(), &client);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user