]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: fs_unref(NULL) should be a no-op
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Fri, 25 May 2018 14:48:29 +0000 (10:48 -0400)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 13 Jun 2018 08:30:02 +0000 (11:30 +0300)
src/lib-fs/fs-api.c

index 9f79d4afef1426bf4678b715bd7a383dfa81cf51..215593b2ff8338c6e81ca06d9bee6cc01cc1c09d 100644 (file)
@@ -197,10 +197,16 @@ void fs_ref(struct fs *fs)
 void fs_unref(struct fs **_fs)
 {
        struct fs *fs = *_fs;
-       string_t *last_error = fs->last_error;
-       struct array module_contexts_arr = fs->module_contexts.arr;
+       string_t *last_error;
+       struct array module_contexts_arr;
        unsigned int i;
 
+       if (fs == NULL)
+               return;
+
+       last_error = fs->last_error;
+       module_contexts_arr = fs->module_contexts.arr;
+
        i_assert(fs->refcount > 0);
 
        *_fs = NULL;