Mercurial > dovecot > core-2.2
changeset 16670:0cf837972a32
dsync: Don't leak iostreams when running via doveadm-server
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 06 Aug 2013 16:32:03 +0300 |
parents | 960f827b7579 |
children | 6c4917396b0d |
files | src/doveadm/dsync/doveadm-dsync.c |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/dsync/doveadm-dsync.c Tue Aug 06 16:28:08 2013 +0300 +++ b/src/doveadm/dsync/doveadm-dsync.c Tue Aug 06 16:32:03 2013 +0300 @@ -452,10 +452,9 @@ fd_set_nonblock(ctx->fd_out, TRUE); ctx->input = i_stream_create_fd(ctx->fd_in, (size_t)-1, FALSE); ctx->output = o_stream_create_fd(ctx->fd_out, (size_t)-1, FALSE); - } else { - i_stream_ref(ctx->input); - o_stream_ref(ctx->output); } + i_stream_ref(ctx->input); + o_stream_ref(ctx->output); if (ctx->rawlog_path != NULL) { iostream_rawlog_create_path(ctx->rawlog_path, &ctx->input, &ctx->output); @@ -592,6 +591,10 @@ ssl_iostream_destroy(&ctx->ssl_iostream); if (ctx->ssl_ctx != NULL) ssl_iostream_context_deinit(&ctx->ssl_ctx); + if (ctx->input != NULL) + i_stream_unref(&ctx->input); + if (ctx->output != NULL) + o_stream_unref(&ctx->output); if (ctx->fd_in != -1) { if (ctx->fd_out != ctx->fd_in) i_close_fd(&ctx->fd_out); @@ -615,8 +618,6 @@ io_remove(&ctx->io_err); if (ctx->fd_err != -1) i_close_fd(&ctx->fd_err); - ctx->input = NULL; - ctx->output = NULL; return ret; }