dovecot-2.0: sdbox: Fixed memory leak when copying messages with...

dovecot at dovecot.org dovecot at dovecot.org
Mon Sep 27 21:53:10 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/d75a01131ddc
changeset: 12190:d75a01131ddc
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Sep 27 19:53:07 2010 +0100
description:
sdbox: Fixed memory leak when copying messages with hard links.

diffstat:

 src/lib-storage/index/dbox-single/sdbox-copy.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 81a3da7f6413 -r d75a01131ddc src/lib-storage/index/dbox-single/sdbox-copy.c
--- a/src/lib-storage/index/dbox-single/sdbox-copy.c	Mon Sep 27 19:34:08 2010 +0100
+++ b/src/lib-storage/index/dbox-single/sdbox-copy.c	Mon Sep 27 19:53:07 2010 +0100
@@ -36,9 +36,8 @@
 	}
 	if (ret < 0) {
 		if (ECANTLINK(errno))
-			return 0;
-
-		if (errno == ENOENT)
+			ret = 0;
+		else if (errno == ENOENT)
 			mail_set_expunged(mail);
 		else {
 			mail_storage_set_critical(
@@ -46,7 +45,9 @@
 				"link(%s, %s) failed: %m",
 				src_path, dest_file->cur_path);
 		}
-		return -1;
+		dbox_file_unref(&src_file);
+		dbox_file_unref(&dest_file);
+		return ret;
 	}
 
 	dbox_save_add_to_index(ctx);
@@ -55,6 +56,7 @@
 		mail_set_seq(_ctx->dest_mail, ctx->seq);
 		_ctx->dest_mail->saving = TRUE;
 	}
+	dbox_file_unref(&src_file);
 	return 1;
 }
 


More information about the dovecot-cvs mailing list