From c666b6310de2d85b3c966ad8de2cfef44d1af1ae Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 3 Oct 2012 00:01:42 +0200 Subject: [PATCH] unix: fix uninitialized memory read in uv__read() This commit fixes the following valgrind warning: ==26443== Conditional jump or move depends on uninitialised value(s) ==26443== at 0x44AAFF: uv__read (stream.c:872) ==26443== by 0x44ADD4: uv__stream_io (stream.c:1051) ==26443== by 0x4377B8: uv__io_rw (core.c:539) ==26443== by 0x43C761: ev_invoke_pending (ev.c:2145) ==26443== by 0x43724D: uv__poll (core.c:260) ==26443== by 0x437297: uv__run (core.c:269) ==26443== by 0x4372F6: uv_run (core.c:277) ==26443== by 0x42094B: run_test_pipe_ref4 (test-ref.c:334) ==26443== by 0x406551: run_test_part (runner.c:302) ==26443== by 0x405384: main (run-tests.c:57) --- src/unix/stream.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/unix/stream.c b/src/unix/stream.c index b00cfb5b..7743ce5a 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -101,6 +101,8 @@ void uv__stream_init(uv_loop_t* loop, uv_stream_t* stream, uv_handle_type type) { uv__handle_init(loop, (uv_handle_t*)stream, type); + stream->read_cb = NULL; + stream->read2_cb = NULL; stream->alloc_cb = NULL; stream->close_cb = NULL; stream->connection_cb = NULL;