X11WindowSystem: fixed memory management mismatch
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Thu, 10 May 2012 11:14:29 +0000 (13:14 +0200)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Thu, 10 May 2012 11:14:29 +0000 (13:14 +0200)
a member of type XVisualInfo was created with new() operator,
but was released with XFree() call which internally uses free().
XFree() was replaced with matching delete() operator calls.

LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp

index 0b85592..cdd7b05 100644 (file)
@@ -63,6 +63,10 @@ X11WindowSystem::X11WindowSystem(const char* displayname, int width, int height,
 
 X11WindowSystem::~X11WindowSystem()
 {
+    if (windowVis)
+    {
+        delete windowVis;
+    }
 }
 
 XVisualInfo* X11WindowSystem::getDefaultVisual(Display *dpy)
@@ -74,7 +78,7 @@ XVisualInfo* X11WindowSystem::getDefaultVisual(Display *dpy)
         if (!XMatchVisualInfo( dpy, 0, windowVis->depth, TrueColor, windowVis))
         {
             LOG_ERROR("X11WindowSystem", "Error: Required visual not found\n");
-            XFree(windowVis);
+            delete windowVis;
             return NULL;
         }
     }
@@ -976,7 +980,7 @@ void X11WindowSystem::cleanup(){
 
     if (windowVis)
     {
-        XFree(windowVis);
+        delete windowVis;
     }
 
 #ifdef WITH_XTHREADS