From 273cecc56ff54d1c6f2537d61838052719db0cb9 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 15 Dec 2012 21:13:41 +0100 Subject: [PATCH] unix: don't memset(0) in uv_udp_init() It's inconsistent with other init functions. In particular, it clobbers the data field. Fixes #655. --- src/unix/udp.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/unix/udp.c b/src/unix/udp.c index 7a970ba0..4b242f64 100644 --- a/src/unix/udp.c +++ b/src/unix/udp.c @@ -446,14 +446,12 @@ static int uv__udp_send(uv_udp_send_t* req, int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) { - memset(handle, 0, sizeof *handle); - uv__handle_init(loop, (uv_handle_t*)handle, UV_UDP); - handle->io_watcher.fd = -1; + handle->alloc_cb = NULL; + handle->recv_cb = NULL; + uv__io_init(&handle->io_watcher, uv__udp_io, -1); ngx_queue_init(&handle->write_queue); ngx_queue_init(&handle->write_completed_queue); - uv__io_init(&handle->io_watcher, uv__udp_io, -1); - return 0; }