remove a memory leak

When the library is not loaded right, delete the pointer to it.
It must be safe, the destructor does nothing.

REVIEW: 102057
icc-effect-5.14.5
Jaime Torres 2011-08-02 17:27:06 +02:00
parent 26a492eb4a
commit c7004ca3b7
1 changed files with 2 additions and 0 deletions

View File

@ -1124,6 +1124,7 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
KLibrary::void_function_ptr version_func = library->resolveFunction(version_symbol.toAscii());
if (version_func == NULL) {
kWarning(1212) << "Effect " << name << " does not provide required API version, ignoring.";
delete library;
return false;
}
typedef int (*t_versionfunc)();
@ -1134,6 +1135,7 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
|| (version >> 8) != KWIN_EFFECT_API_VERSION_MAJOR
|| (KWIN_EFFECT_API_VERSION_MAJOR == 0 && version != KWIN_EFFECT_API_VERSION)) {
kWarning(1212) << "Effect " << name << " requires unsupported API version " << version;
delete library;
return false;
}