From: Josef 'Jeff' Sipek Date: Tue, 6 Jun 2017 09:49:00 +0000 (+0300) Subject: lib: [io]_stream_destroy(NULL) should be a no-op X-Git-Tag: 2.3.0.rc1~983 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d6684856fb99e51bc22a6346e08b2d81c996f963;p=thirdparty%2Fdovecot%2Fcore.git lib: [io]_stream_destroy(NULL) should be a no-op --- diff --git a/src/lib/istream.c b/src/lib/istream.c index 6a2cfe0ced..cf5f81a382 100644 --- a/src/lib/istream.c +++ b/src/lib/istream.c @@ -35,6 +35,9 @@ static void i_stream_close_full(struct istream *stream, bool close_parents) void i_stream_destroy(struct istream **stream) { + if (*stream == NULL) + return; + i_stream_close_full(*stream, FALSE); i_stream_unref(stream); } diff --git a/src/lib/ostream.c b/src/lib/ostream.c index 50bd479783..175e417b04 100644 --- a/src/lib/ostream.c +++ b/src/lib/ostream.c @@ -61,6 +61,9 @@ static void o_stream_close_full(struct ostream *stream, bool close_parents) void o_stream_destroy(struct ostream **stream) { + if (*stream == NULL) + return; + o_stream_close_full(*stream, FALSE); o_stream_unref(stream); }