]> git.saurik.com Git - redis.git/commitdiff
Fixed a theoretical memory leak with no practical effects in ae_kqueue.c and ae_epoll...
authorantirez <antirez@gmail.com>
Wed, 7 Dec 2011 07:58:29 +0000 (08:58 +0100)
committerantirez <antirez@gmail.com>
Wed, 7 Dec 2011 07:58:29 +0000 (08:58 +0100)
src/ae_epoll.c
src/ae_kqueue.c

index d48977b6533c689f3b89e814a5bdd4b94855946b..5680b6a2767617319e1d07732530553d1eb2457b 100644 (file)
@@ -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;
 }
index 04c3536ba7f80892ef00cfaa20d6a109776d0e15..6bf64f4ef868be13203ebfb2aefd70a6f9dfe9f1 100644 (file)
@@ -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;