dovecot-2.2: dsync: Don't leak iostreams when running via dovead...

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 6 16:32:14 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/0cf837972a32
changeset: 16670:0cf837972a32
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Aug 06 16:32:03 2013 +0300
description:
dsync: Don't leak iostreams when running via doveadm-server

diffstat:

 src/doveadm/dsync/doveadm-dsync.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r 960f827b7579 -r 0cf837972a32 src/doveadm/dsync/doveadm-dsync.c
--- 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;
 }


More information about the dovecot-cvs mailing list