]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: When sending server logs to client, make sure ioloop isn't set to NULL
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 20 Nov 2020 10:15:18 +0000 (12:15 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 23 Nov 2020 10:59:35 +0000 (12:59 +0200)
This could have happened if there was any logging done outside command
handling. For example a doveadm command used http-client, which has a
timeout that triggers logging only after the command is finished.

Fixes segfault and:
Panic: file http-client.c: line 642 (http_client_context_close): assertion failed: (cctx->clients_list == NULL)

src/doveadm/client-connection-tcp.c

index 96efa1f2bbacf4b77ddc34a7029cecaf53b229e0..4ec3dc7a3c06d0972d985afa326a0547aa675888 100644 (file)
@@ -80,7 +80,8 @@ doveadm_server_log_handler(const struct failure_context *ctx,
 
                /* since we can get here from just about anywhere, make sure
                   the log ostream uses the connection's ioloop. */
-               io_loop_set_current(conn->ioloop);
+               if (conn->ioloop != NULL)
+                       io_loop_set_current(conn->ioloop);
 
                c = doveadm_log_type_to_char(ctx->type);
                corked = o_stream_is_corked(log_out);