Commit fb293ccb authored by antirez's avatar antirez
Browse files

Fixed a theoretical memory leak with no practical effects in ae_kqueue.c and...

Fixed a theoretical memory leak with no practical effects in ae_kqueue.c and ae_epoll.c, thanks to magicyang87 for reporting it.
parent 237194b7
......@@ -14,7 +14,10 @@ static int aeApiCreate(aeEventLoop *eventLoop) {
if (!state) return -1;
state->epfd = epoll_create(1024); /* 1024 is just an hint for the kernel */
if (state->epfd == -1) return -1;
if (state->epfd == -1) {
zfree(state);
return -1;
}
eventLoop->apidata = state;
return 0;
}
......
......@@ -16,7 +16,10 @@ static int aeApiCreate(aeEventLoop *eventLoop) {
if (!state) return -1;
state->kqfd = kqueue();
if (state->kqfd == -1) return -1;
if (state->kqfd == -1) {
zfree(state);
return -1;
}
eventLoop->apidata = state;
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment