From 6d195109eb4c7233486fefe7cef834e912f610ec Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 13 May 2010 14:59:33 -0400 Subject: [PATCH] Avoid event_del on uninitialized event in event_base_free This was mostly harmless, since the event was cleared with calloc, but still it's not a correct thing to do. --- event.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/event.c b/event.c index f7b69f52..eecabbe2 100644 --- a/event.c +++ b/event.c @@ -533,7 +533,6 @@ event_base_new_with_config(const struct event_config *cfg) event_warn("%s: calloc", __func__); return NULL; } - detect_monotonic(); gettime(base, &base->event_tv); @@ -541,6 +540,8 @@ event_base_new_with_config(const struct event_config *cfg) TAILQ_INIT(&base->eventqueue); base->sig.ev_signal_pair[0] = -1; base->sig.ev_signal_pair[1] = -1; + base->th_notify_fd[0] = -1; + base->th_notify_fd[1] = -1; event_deferred_cb_queue_init(&base->defer_queue); base->defer_queue.notify_fn = notify_base_cbq_callback; @@ -595,8 +596,6 @@ event_base_new_with_config(const struct event_config *cfg) } /* prepare for threading */ - base->th_notify_fd[0] = -1; - base->th_notify_fd[1] = -1; #ifndef _EVENT_DISABLE_THREAD_SUPPORT if (!cfg || !(cfg->flags & EVENT_BASE_FLAG_NOLOCK)) {