diff --git a/libweston/compositor.c b/libweston/compositor.c index af0da062..72a2905e 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -7618,15 +7618,13 @@ weston_load_module(const char *name, const char *entrypoint) module = dlopen(path, RTLD_NOW | RTLD_NOLOAD); if (module) { weston_log("Module '%s' already loaded\n", path); - dlclose(module); - return NULL; - } - - weston_log("Loading module '%s'\n", path); - module = dlopen(path, RTLD_NOW); - if (!module) { - weston_log("Failed to load module: %s\n", dlerror()); - return NULL; + } else { + weston_log("Loading module '%s'\n", path); + module = dlopen(path, RTLD_NOW); + if (!module) { + weston_log("Failed to load module: %s\n", dlerror()); + return NULL; + } } init = dlsym(module, entrypoint);