Index: src/OFPlugin.m ================================================================== --- src/OFPlugin.m +++ src/OFPlugin.m @@ -44,20 +44,27 @@ } memcpy(file, path, pathlen); memcpy(file + pathlen, PLUGIN_SUFFIX, suffixlen); file[pathlen + suffixlen] = 0; - if ((handle = dlopen(file, RTLD_NOW)) == NULL || - (init_plugin = dlsym(handle, "init_plugin")) == NULL || - (plugin = init_plugin()) == nil) { + if ((handle = dlopen(file, RTLD_NOW)) == NULL) { free(file); c = [self class]; [super free]; @throw [OFInitializationFailedException newWithClass: c]; } free(file); + + if ((init_plugin = dlsym(handle, "init_plugin")) == NULL || + (plugin = init_plugin()) == nil) { + dlclose(handle); + c = [self class]; + [super free]; + @throw [OFInitializationFailedException + newWithClass: c]; + } } return self; }