Mercurial > dovecot > core-2.2
changeset 15735:275973a62419
lib-fs: Avoid memory leaks if file was closed before fs_read()/fs_copy() was finished.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 05 Feb 2013 03:23:30 +0200 |
parents | 15ad5fc0568b |
children | c31ee24e7255 |
files | src/lib-fs/fs-api.c |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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);