]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Don't call module's deinit() if its init() hasn't been called.
authorTimo Sirainen <tss@iki.fi>
Thu, 4 Mar 2010 18:00:43 +0000 (20:00 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 4 Mar 2010 18:00:43 +0000 (20:00 +0200)
--HG--
branch : HEAD

src/lib/module-dir.c

index 4497601abff779c180a166a67358fe3a71f5f43b..d88713fca61bfd01fd8992d15c4dd2d0a28337e4 100644 (file)
@@ -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;