]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Event: Fix memory leak for notify fd
authorHaomai Wang <haomaiwang@gmail.com>
Mon, 20 Apr 2015 02:41:50 +0000 (10:41 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Mon, 20 Apr 2015 03:01:15 +0000 (11:01 +0800)
Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/msg/async/Event.cc

index a2fb88cd6965979b512df520c5974a9bf32d194e..cf60a00607572ed22d5a040bb0b25d6073df9128 100644 (file)
@@ -99,12 +99,14 @@ EventCenter::~EventCenter()
 {
   delete driver;
 
-  if (file_events)
-    free(file_events);
-  if (notify_receive_fd > 0)
+  if (notify_receive_fd >= 0) {
+    delete_file_event(notify_receive_fd, EVENT_READABLE);
     ::close(notify_receive_fd);
-  if (notify_send_fd > 0)
+  }
+  if (notify_send_fd >= 0)
     ::close(notify_send_fd);
+  if (file_events)
+    free(file_events);
 }
 
 int EventCenter::create_file_event(int fd, int mask, EventCallbackRef ctxt)