From: Timo Sirainen Date: Thu, 14 Dec 2017 08:31:26 +0000 (+0200) Subject: lib: Fix static analyzer warning about uninitialized va_list X-Git-Tag: 2.3.0.rc1~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec61c407caf0ade72e3c8ad881cc445653ccfa1f;p=thirdparty%2Fdovecot%2Fcore.git lib: Fix static analyzer warning about uninitialized va_list --- diff --git a/src/lib/lib-event.c b/src/lib/lib-event.c index 9c0984aa0e..c659e22e5e 100644 --- a/src/lib/lib-event.c +++ b/src/lib/lib-event.c @@ -121,6 +121,19 @@ struct event *event_ref(struct event *event) return event; } +static void event_send_free(struct event *event, ...) +{ + va_list args; + + /* the args are empty and not used for anything, but there doesn't seem + to be any nice and standard way of passing an initialized va_list + as a parameter without va_start(). */ + va_start(args, event); + (void)event_send_callbacks(event, EVENT_CALLBACK_TYPE_FREE, + NULL, NULL, args); + va_end(args); +} + void event_unref(struct event **_event) { struct event *event = *_event; @@ -134,11 +147,8 @@ void event_unref(struct event **_event) return; i_assert(event != current_global_event); - if (event->call_free) { - va_list empty; - (void)event_send_callbacks(event, EVENT_CALLBACK_TYPE_FREE, - NULL, NULL, empty); - } + if (event->call_free) + event_send_free(event); if (last_passthrough_event() == event) event_last_passthrough = NULL;