From: Timo Sirainen Date: Thu, 23 Apr 2015 08:40:03 +0000 (+0300) Subject: lib: iostream_rawlog_create_from_stream() now allows input or output to be NULL. X-Git-Tag: 2.2.17.rc1~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc64b2b538099893e2c2dde103b5c5af1d05d6da;p=thirdparty%2Fdovecot%2Fcore.git lib: iostream_rawlog_create_from_stream() now allows input or output to be NULL. --- diff --git a/src/lib/iostream-rawlog.c b/src/lib/iostream-rawlog.c index 435da5dd92..3f111e9278 100644 --- a/src/lib/iostream-rawlog.c +++ b/src/lib/iostream-rawlog.c @@ -285,13 +285,17 @@ void iostream_rawlog_create_from_stream(struct ostream *rawlog_output, struct istream *old_input; struct ostream *old_output; - old_input = *input; - old_output = *output; + if (input != NULL) { + old_input = *input; + *input = i_stream_create_rawlog_from_stream(old_input, + rawlog_output, rawlog_flags); + i_stream_unref(&old_input); + } + if (output != NULL) { + old_output = *output; + *output = o_stream_create_rawlog_from_stream(old_output, + rawlog_output, rawlog_flags); + o_stream_unref(&old_output); + } o_stream_ref(rawlog_output); - *input = i_stream_create_rawlog_from_stream(old_input, rawlog_output, - rawlog_flags); - *output = o_stream_create_rawlog_from_stream(old_output, rawlog_output, - rawlog_flags); - i_stream_unref(&old_input); - o_stream_unref(&old_output); }