libevent: call destroy from cleanup

also, indentation fix
This commit is contained in:
Mark Nunberg 2019-02-11 14:56:56 -05:00
parent 1eb44cf0c4
commit f0a7595056
1 changed files with 6 additions and 6 deletions

View File

@ -47,7 +47,7 @@ typedef struct redisLibeventEvents {
} redisLibeventEvents;
static void redisLibeventDestroy(redisLibeventEvents *e) {
free(e);
free(e);
}
static void redisLibeventHandler(int fd, short event, void *arg) {
@ -56,8 +56,8 @@ static void redisLibeventHandler(int fd, short event, void *arg) {
e->state |= REDIS_LIBEVENT_ENTERED;
#define CHECK_DELETED() if (e->state & REDIS_LIBEVENT_DELETED) {\
redisLibeventDestroy(e);\
return; \
redisLibeventDestroy(e);\
return; \
}
if ((event & EV_TIMEOUT) && (e->state & REDIS_LIBEVENT_DELETED) == 0) {
@ -122,16 +122,16 @@ static void redisLibeventDelWrite(void *privdata) {
static void redisLibeventCleanup(void *privdata) {
redisLibeventEvents *e = (redisLibeventEvents*)privdata;
if (!e) {
return;
return;
}
event_del(e->ev);
event_free(e->ev);
e->ev = NULL;
if (e->state & REDIS_LIBEVENT_ENTERED) {
e->state |= REDIS_LIBEVENT_DELETED;
e->state |= REDIS_LIBEVENT_DELETED;
} else {
free(e);
redisLibeventDestroy(e);
}
}