dovecot-2.2: lib-fs: Avoid memory leaks if file was closed befor...

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 5 03:24:58 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/275973a62419
changeset: 15735:275973a62419
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 05 03:23:30 2013 +0200
description:
lib-fs: Avoid memory leaks if file was closed before fs_read()/fs_copy() was finished.

diffstat:

 src/lib-fs/fs-api.c |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (18 lines):

diff -r 15ad5fc0568b -r 275973a62419 src/lib-fs/fs-api.c
--- a/src/lib-fs/fs-api.c	Tue Feb 05 01:16:48 2013 +0200
+++ b/src/lib-fs/fs-api.c	Tue Feb 05 03:23:30 2013 +0200
@@ -164,6 +164,14 @@
 
 	*_file = NULL;
 
+	if (file->pending_read_input != NULL)
+		i_stream_unref(&file->pending_read_input);
+
+	if (file->copy_input != NULL) {
+		i_stream_unref(&file->copy_input);
+		(void)fs_write_stream_abort(file, &file->copy_output);
+	}
+
 	file->fs->files_open_count--;
 	file->fs->v.file_deinit(file);
 


More information about the dovecot-cvs mailing list