]> arthur.barton.de Git - netatalk.git/blobdiff - libevent/epoll.c
Writing metadata xattr on directories with sticky bit set, FR#94
[netatalk.git] / libevent / epoll.c
index 2d4aebfbdd3169d74dc04dc8c8933746d180c867..4c5c3da01a5bb2a8c4ee0a5267ebf66db589d10d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright 2000-2007 Niels Provos <provos@citi.umich.edu>
- * Copyright 2007-2010 Niels Provos, Nick Mathewson
+ * Copyright 2007-2012 Niels Provos, Nick Mathewson
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -120,8 +120,10 @@ epoll_init(struct event_base *base)
 
        evutil_make_socket_closeonexec(epfd);
 
-       if (!(epollop = mm_calloc(1, sizeof(struct epollop))))
+       if (!(epollop = mm_calloc(1, sizeof(struct epollop)))) {
+               close(epfd);
                return (NULL);
+       }
 
        epollop->epfd = epfd;
 
@@ -129,6 +131,7 @@ epoll_init(struct event_base *base)
        epollop->events = mm_calloc(INITIAL_NEVENT, sizeof(struct epoll_event));
        if (epollop->events == NULL) {
                mm_free(epollop);
+               close(epfd);
                return (NULL);
        }
        epollop->nevents = INITIAL_NEVENT;