changeset 17591:00b3aa3842b7

lib-compression: Compression ostreams may have caused parent ostream to use too much memory.
author Timo Sirainen <tss@iki.fi>
date Thu, 03 Jul 2014 21:55:31 +0300
parents 5740cb57d02c
children a372391290a3
files src/lib-compression/ostream-bzlib.c src/lib-compression/ostream-lzma.c src/lib-compression/ostream-zlib.c
diffstat 3 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-compression/ostream-bzlib.c	Thu Jul 03 21:54:52 2014 +0300
+++ b/src/lib-compression/ostream-bzlib.c	Thu Jul 03 21:55:31 2014 +0300
@@ -113,6 +113,8 @@
 	if (zstream->flushed)
 		return 0;
 
+	if ((ret = o_stream_flush_parent_if_needed(&zstream->ostream)) <= 0)
+		return ret;
 	if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0)
 		return ret;
 
--- a/src/lib-compression/ostream-lzma.c	Thu Jul 03 21:54:52 2014 +0300
+++ b/src/lib-compression/ostream-lzma.c	Thu Jul 03 21:55:31 2014 +0300
@@ -119,6 +119,8 @@
 	if (zstream->flushed)
 		return 0;
 
+	if ((ret = o_stream_flush_parent_if_needed(&zstream->ostream)) <= 0)
+		return ret;
 	if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0)
 		return ret;
 
--- a/src/lib-compression/ostream-zlib.c	Thu Jul 03 21:54:52 2014 +0300
+++ b/src/lib-compression/ostream-zlib.c	Thu Jul 03 21:55:31 2014 +0300
@@ -181,6 +181,9 @@
 
 	if (zstream->flushed)
 		return 0;
+
+	if ((ret = o_stream_flush_parent_if_needed(&zstream->ostream)) <= 0)
+		return ret;
 	if (!zstream->header_sent) {
 		if (o_stream_zlib_send_gz_header(zstream) < 0)
 			return -1;