From: Timo Sirainen Date: Wed, 13 Jun 2018 17:07:28 +0000 (+0300) Subject: dsync: Fix memory leak - unreference iostreams at deinit X-Git-Tag: 2.3.9~1715 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4cd8c5ba9d3715e25f6795c2b34d5b1002e4671;p=thirdparty%2Fdovecot%2Fcore.git dsync: Fix memory leak - unreference iostreams at deinit Only some of the code paths need unreferencing, so also add a reference to the other code paths. --- diff --git a/src/doveadm/doveadm-dsync.c b/src/doveadm/doveadm-dsync.c index 194b3977ac..718d5a0c0a 100644 --- a/src/doveadm/doveadm-dsync.c +++ b/src/doveadm/doveadm-dsync.c @@ -1176,6 +1176,8 @@ cmd_dsync_server_run(struct doveadm_mail_cmd_context *_ctx, ctx->fd_in = ctx->fd_out = -1; ctx->input = cctx->input; ctx->output = cctx->output; + i_stream_ref(ctx->input); + o_stream_ref(ctx->output); o_stream_set_finish_also_parent(ctx->output, FALSE); o_stream_nsend(ctx->output, "\n+\n", 3); i_set_failure_prefix("dsync-server(%s): ", user->username); @@ -1218,6 +1220,8 @@ cmd_dsync_server_run(struct doveadm_mail_cmd_context *_ctx, connection code */ o_stream_close(cctx->output); } + i_stream_unref(&ctx->input); + o_stream_unref(&ctx->output); if (ctx->replicator_notify && _ctx->exit_code == 0) dsync_replicator_notify(ctx, sync_type, str_c(state_str));