diff --git a/adapters/libevent.h b/adapters/libevent.h index 9843696..5959e89 100644 --- a/adapters/libevent.h +++ b/adapters/libevent.h @@ -48,10 +48,10 @@ static void redisLibeventHandler(int fd, short event, void *arg) { if (event & EV_TIMEOUT) { redisAsyncHandleTimeout(e->context); } - if (e->context && (event & EV_READ)) { + if ((event & EV_READ) && e->context) { redisAsyncHandleRead(e->context); } - if (e->context && (event & EV_WRITE)) { + if ((event & EV_WRITE) && e->context) { redisAsyncHandleWrite(e->context); } } @@ -107,7 +107,6 @@ static void redisLibeventSetTimeout(void *privdata, struct timeval tv) { short flags = e->flags; e->flags = 0; e->tv = tv; - event_del(e->ev); redisLibeventUpdate(e, flags, 0); } diff --git a/hiredis.c b/hiredis.c index dd499b8..9c2788a 100644 --- a/hiredis.c +++ b/hiredis.c @@ -618,6 +618,7 @@ void redisFree(redisContext *c) { if (c->ssl) { redisFreeSsl(c->ssl); } + free(c); } int redisFreeKeepFd(redisContext *c) {