mirror of
https://github.com/fluencelabs/redis
synced 2025-03-20 09:30:55 +00:00
Fixed a theoretical memory leak with no practical effects in ae_kqueue.c and ae_epoll.c, thanks to magicyang87 for reporting it.
This commit is contained in:
parent
237194b760
commit
fb293ccbdd
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user