Permalink
Browse files

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.
  • Loading branch information...
1 parent c6c5b7a commit 273cecc56ff54d1c6f2537d61838052719db0cb9 @bnoordhuis bnoordhuis committed Dec 15, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 src/unix/udp.c
View
@@ -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;
}

0 comments on commit 273cecc

Please sign in to comment.