From c7004ca3b772eb8bd728ca8e8bf3b56096ff6f11 Mon Sep 17 00:00:00 2001 From: Jaime Torres Date: Tue, 2 Aug 2011 17:27:06 +0200 Subject: [PATCH] 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 --- effects.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/effects.cpp b/effects.cpp index 45233136f8..0c7701db54 100644 --- a/effects.cpp +++ b/effects.cpp @@ -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; }