diff options
author | Paul Scott <paul.m.sco@gmail.com> | 2016-09-19 11:48:54 +1000 |
---|---|---|
committer | Paul Scott <paul.m.sco@gmail.com> | 2016-09-19 11:48:54 +1000 |
commit | cbb956567b715acd3022eb07a46eb6e23cd038e1 (patch) | |
tree | 6c5379c5df7050ec7d8d45e4c9f24c853168e848 | |
parent | 5f98e1d35dcf00a026793ada2662f6e1ba77eb17 (diff) |
Prevented uv adapter from calling write when context has been freed
-rw-r--r-- | adapters/libuv.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/adapters/libuv.h b/adapters/libuv.h index 3cdf3d3..ff08c25 100644 --- a/adapters/libuv.h +++ b/adapters/libuv.h @@ -20,10 +20,10 @@ static void redisLibuvPoll(uv_poll_t* handle, int status, int events) { return; } - if (events & UV_READABLE) { + if (p->context != NULL && (events & UV_READABLE)) { redisAsyncHandleRead(p->context); } - if (events & UV_WRITABLE) { + if (p->context != NULL && (events & UV_WRITABLE)) { redisAsyncHandleWrite(p->context); } } @@ -83,6 +83,7 @@ static void on_close(uv_handle_t* handle) { static void redisLibuvCleanup(void *privdata) { redisLibuvEvents* p = (redisLibuvEvents*)privdata; + p->context = NULL; // indicate that context might no longer exist uv_close((uv_handle_t*)&p->handle, on_close); } |