mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-19 01:04:58 -04:00
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.
This commit is contained in:
parent
2b44dccaaf
commit
6d195109eb
5
event.c
5
event.c
@ -533,7 +533,6 @@ event_base_new_with_config(const struct event_config *cfg)
|
|||||||
event_warn("%s: calloc", __func__);
|
event_warn("%s: calloc", __func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
detect_monotonic();
|
detect_monotonic();
|
||||||
gettime(base, &base->event_tv);
|
gettime(base, &base->event_tv);
|
||||||
|
|
||||||
@ -541,6 +540,8 @@ event_base_new_with_config(const struct event_config *cfg)
|
|||||||
TAILQ_INIT(&base->eventqueue);
|
TAILQ_INIT(&base->eventqueue);
|
||||||
base->sig.ev_signal_pair[0] = -1;
|
base->sig.ev_signal_pair[0] = -1;
|
||||||
base->sig.ev_signal_pair[1] = -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);
|
event_deferred_cb_queue_init(&base->defer_queue);
|
||||||
base->defer_queue.notify_fn = notify_base_cbq_callback;
|
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 */
|
/* prepare for threading */
|
||||||
base->th_notify_fd[0] = -1;
|
|
||||||
base->th_notify_fd[1] = -1;
|
|
||||||
|
|
||||||
#ifndef _EVENT_DISABLE_THREAD_SUPPORT
|
#ifndef _EVENT_DISABLE_THREAD_SUPPORT
|
||||||
if (!cfg || !(cfg->flags & EVENT_BASE_FLAG_NOLOCK)) {
|
if (!cfg || !(cfg->flags & EVENT_BASE_FLAG_NOLOCK)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user