From: Timo Sirainen Date: Sun, 3 Nov 2013 21:27:15 +0000 (+0200) Subject: ostream: Mark stream closed before handling its callback to avoid infinite loops. X-Git-Tag: 2.2.8~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=59e26ff34b05cd971a111f8a42fc60c13d9f688b;p=thirdparty%2Fdovecot%2Fcore.git ostream: Mark stream closed before handling its callback to avoid infinite loops. The callback could call o_stream_copy_error_from_parent(), which in turn would try to close the same ostream again. --- diff --git a/src/lib/ostream.c b/src/lib/ostream.c index de58b2f1ad..73456aa66a 100644 --- a/src/lib/ostream.c +++ b/src/lib/ostream.c @@ -46,8 +46,8 @@ const char *o_stream_get_error(struct ostream *stream) static void o_stream_close_full(struct ostream *stream, bool close_parents) { if (!stream->closed) { - io_stream_close(&stream->real_stream->iostream, close_parents); stream->closed = TRUE; + io_stream_close(&stream->real_stream->iostream, close_parents); } if (stream->stream_errno == 0)