]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: [io]_stream_destroy(NULL) should be a no-op
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Tue, 6 Jun 2017 09:49:00 +0000 (12:49 +0300)
committerJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Wed, 20 Sep 2017 09:29:06 +0000 (12:29 +0300)
src/lib/istream.c
src/lib/ostream.c

index 6a2cfe0cedf63e80ef4e61f74e20cc7761706843..cf5f81a382153b69f12b8cb65b3ff812b4f6a2ce 100644 (file)
@@ -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);
 }
index 50bd47978386644b0e60b47fd7baa4b867a00622..175e417b04ec6041807ee5132d436567b84477a0 100644 (file)
@@ -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);
 }