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);
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;