From e4cd8c5ba9d3715e25f6795c2b34d5b1002e4671 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 13 Jun 2018 20:07:28 +0300 Subject: [PATCH] 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. --- src/doveadm/doveadm-dsync.c | 4 ++++ 1 file changed, 4 insertions(+) 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)); -- 2.47.3