From: Josef 'Jeff' Sipek Date: Fri, 25 May 2018 14:48:29 +0000 (-0400) Subject: lib-fs: fs_unref(NULL) should be a no-op X-Git-Tag: 2.3.2.rc1~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3eb5fc7ad06c0e1a8758796aed8aa374ff42e3fe;p=thirdparty%2Fdovecot%2Fcore.git lib-fs: fs_unref(NULL) should be a no-op --- diff --git a/src/lib-fs/fs-api.c b/src/lib-fs/fs-api.c index 9f79d4afef..215593b2ff 100644 --- a/src/lib-fs/fs-api.c +++ b/src/lib-fs/fs-api.c @@ -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;