event: Do an early return from event_teardown when not initialized

This commit is contained in:
Thiago de Arruda 2014-11-03 15:31:41 -03:00
parent 9615258d1a
commit 74b9f33a95

View File

@ -39,7 +39,7 @@ typedef struct {
// immediate_events: Events that should be processed after exiting libuv event // immediate_events: Events that should be processed after exiting libuv event
// loop(to avoid recursion), but before returning from // loop(to avoid recursion), but before returning from
// `event_poll` // `event_poll`
static klist_t(Event) *deferred_events, *immediate_events; static klist_t(Event) *deferred_events = NULL, *immediate_events = NULL;
void event_init(void) void event_init(void)
{ {
@ -68,6 +68,11 @@ void event_init(void)
void event_teardown(void) void event_teardown(void)
{ {
if (!deferred_events) {
// Not initialized(possibly a --version invocation)
return;
}
channel_teardown(); channel_teardown();
job_teardown(); job_teardown();
server_teardown(); server_teardown();