From: Timo Sirainen Date: Thu, 4 Mar 2010 18:00:43 +0000 (+0200) Subject: Don't call module's deinit() if its init() hasn't been called. X-Git-Tag: 2.0.beta4~134 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02392c7df4f6bc5cb71617e757c39dce0debd23b;p=thirdparty%2Fdovecot%2Fcore.git Don't call module's deinit() if its init() hasn't been called. --HG-- branch : HEAD --- diff --git a/src/lib/module-dir.c b/src/lib/module-dir.c index 4497601abf..d88713fca6 100644 --- a/src/lib/module-dir.c +++ b/src/lib/module-dir.c @@ -56,7 +56,7 @@ static void *get_symbol(struct module *module, const char *symbol, bool quiet) static void module_free(struct module *module) { - if (module->deinit != NULL) + if (module->deinit != NULL && module->initialized) module->deinit(); if (dlclose(module->handle) != 0) i_error("dlclose(%s) failed: %m", module->path); @@ -361,9 +361,9 @@ void module_dir_deinit(struct module *modules) for (i = 0; i < count; i++) { module = rev[i]; - if (module->deinit != NULL) { + if (module->deinit != NULL && module->initialized) { module->deinit(); - module->deinit = NULL; + module->initialized = FALSE; } } } T_END;