Skip to content

Commit

Permalink
dsync: Fix memory leak - unreference iostreams at deinit
Browse files Browse the repository at this point in the history
Only some of the code paths need unreferencing, so also add a reference to
the other code paths.
  • Loading branch information
sirainen committed Aug 22, 2018
1 parent 2a43107 commit 8438506
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/doveadm/doveadm-dsync.c
Expand Up @@ -1171,6 +1171,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);
Expand Down Expand Up @@ -1213,6 +1215,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));
Expand Down

0 comments on commit 8438506

Please sign in to comment.