]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Fix static analyzer warning about uninitialized va_list
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 14 Dec 2017 08:31:26 +0000 (10:31 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 14 Dec 2017 22:34:11 +0000 (00:34 +0200)
src/lib/lib-event.c

index 9c0984aa0e0e0d2933c81e0b7d5fd6633f44833c..c659e22e5e58265e7ecc46c212ec2e92ce5fd30d 100644 (file)
@@ -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;