]> granicus.if.org Git - libevent/commitdiff
Fix a fd leak in event_reinit()
authorNick Mathewson <nickm@torproject.org>
Mon, 23 Jan 2012 23:15:44 +0000 (18:15 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 23 Jan 2012 23:15:44 +0000 (18:15 -0500)
We were supposed to be closing the ev_signal_pair sockets.

event.c

diff --git a/event.c b/event.c
index d7085bc1b16c5291ebb569e66c75b3efe3675903..b2e9645110fc571fed5e7ec82fa0adf90cd66d42 100644 (file)
--- a/event.c
+++ b/event.c
@@ -820,6 +820,10 @@ event_reinit(struct event_base *base)
                if (base->sig.ev_signal.ev_flags & EVLIST_ACTIVE)
                        event_queue_remove(base, &base->sig.ev_signal,
                            EVLIST_ACTIVE);
+               if (base->sig.ev_signal_pair[0] != -1)
+                       EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[0]);
+               if (base->sig.ev_signal_pair[1] != -1)
+                       EVUTIL_CLOSESOCKET(base->sig.ev_signal_pair[1]);
                base->sig.ev_signal_added = 0;
        }
        if (base->th_notify_fd[0] != -1) {