diff options
author | Bert Belder <bertbelder@gmail.com> | 2011-08-03 02:27:16 +0400 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2011-08-03 02:27:16 +0400 |
commit | 6efc86df6a91fca05791812bbbfc4d265c1cb387 (patch) | |
tree | 2791bfa3d2ef2be0828aaa4cefc882fd844bcec3 /deps/uv | |
parent | 38f948a373aa3dc8c46628bbd53edf07b6f16ea7 (diff) |
Upgrade libuv to dbaddc4423d61fa16cca299650f8378cffba9cce
Diffstat (limited to 'deps/uv')
-rw-r--r-- | deps/uv/src/win/pipe.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c index 1eb49731913..9b8bdbddcbe 100644 --- a/deps/uv/src/win/pipe.c +++ b/deps/uv/src/win/pipe.c @@ -147,6 +147,7 @@ static int uv_set_pipe_handle(uv_pipe_t* handle, HANDLE pipeHandle) { void uv_pipe_endgame(uv_pipe_t* handle) { uv_err_t err; int status; + unsigned int uv_alloced; if (handle->flags & UV_HANDLE_SHUTTING && !(handle->flags & UV_HANDLE_SHUT) && @@ -167,11 +168,15 @@ void uv_pipe_endgame(uv_pipe_t* handle) { assert(!(handle->flags & UV_HANDLE_CLOSED)); handle->flags |= UV_HANDLE_CLOSED; + /* Remember the state of this flag because the close callback is */ + /* allowed to clobber or free the handle's memory */ + uv_alloced = handle->flags & UV_HANDLE_UV_ALLOCED; + if (handle->close_cb) { handle->close_cb((uv_handle_t*)handle); } - if (handle->flags & UV_HANDLE_UV_ALLOCED) { + if (uv_alloced) { free(handle); } |