dovecot-2.2: Fixed a memory leak.

dovecot at dovecot.org dovecot at dovecot.org
Sat Apr 20 21:02:38 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/994488139eca
changeset: 16305:994488139eca
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Apr 20 21:02:30 2013 +0300
description:
Fixed a memory leak.

diffstat:

 src/lib-mail/istream-attachment-connector.c |  20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r cac2978505b8 -r 994488139eca src/lib-mail/istream-attachment-connector.c
--- a/src/lib-mail/istream-attachment-connector.c	Sat Apr 20 20:58:06 2013 +0300
+++ b/src/lib-mail/istream-attachment-connector.c	Sat Apr 20 21:02:30 2013 +0300
@@ -88,6 +88,20 @@
 	return 0;
 }
 
+static void
+istream_attachment_connector_free(struct istream_attachment_connector *conn)
+{
+	struct istream *const *streamp, *stream;
+
+	array_foreach(&conn->streams, streamp) {
+		stream = *streamp;
+		if (stream != NULL)
+			i_stream_unref(&stream);
+	}
+	i_stream_unref(&conn->base_input);
+	pool_unref(&conn->pool);
+}
+
 struct istream *
 istream_attachment_connector_finish(struct istream_attachment_connector **_conn)
 {
@@ -111,8 +125,7 @@
 	inputs = array_idx_modifiable(&conn->streams, 0);
 	input = i_stream_create_concat(inputs);
 
-	i_stream_unref(&conn->base_input);
-	pool_unref(&conn->pool);
+	istream_attachment_connector_free(conn);
 	return input;
 }
 
@@ -122,6 +135,5 @@
 
 	*_conn = NULL;
 
-	i_stream_unref(&conn->base_input);
-	pool_unref(&conn->pool);
+	istream_attachment_connector_free(conn);
 }


More information about the dovecot-cvs mailing list