dovecot-2.2: lib-http: ref/unref input stream in http message pa...

dovecot at dovecot.org dovecot at dovecot.org
Mon Nov 16 10:30:21 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/fe23c9b18c9d
changeset: 19359:fe23c9b18c9d
user:      Phil Carmody <phil at dovecot.fi>
date:      Mon Nov 16 12:26:06 2015 +0200
description:
lib-http: ref/unref input stream in http message parser
To prevent assidental disappearance of the stream while it's in use.
Also, the caller can create and forget - we'll do the cleanup later.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib-http/http-message-parser.c |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (20 lines):

diff -r c0229e018a24 -r fe23c9b18c9d src/lib-http/http-message-parser.c
--- a/src/lib-http/http-message-parser.c	Mon Nov 16 12:24:53 2015 +0200
+++ b/src/lib-http/http-message-parser.c	Mon Nov 16 12:26:06 2015 +0200
@@ -20,6 +20,7 @@
 {
 	memset(parser, 0, sizeof(*parser));
 	parser->input = input;
+	i_stream_ref(parser->input);
 	if (hdr_limits != NULL)
 		parser->header_limits = *hdr_limits;
 	parser->max_payload_size = max_payload_size;
@@ -34,6 +35,8 @@
 		pool_unref(&parser->msg.pool);
 	if (parser->payload != NULL)
 		i_stream_unref(&parser->payload);
+	if (parser->input != NULL)
+		i_stream_unref(&parser->input);
 }
 
 void http_message_parser_restart(struct http_message_parser *parser,


More information about the dovecot-cvs mailing list