]> git.sesse.net Git - vlc/commitdiff
skins2: fix memory leak regarding previous commit
authorErwan Tulou <erwan10@videolan.org>
Thu, 9 Jun 2011 20:18:42 +0000 (22:18 +0200)
committerErwan Tulou <erwan10@videolan.org>
Thu, 9 Jun 2011 20:29:43 +0000 (22:29 +0200)
modules/gui/skins2/x11/x11_factory.cpp

index fca747eece453f5eaed66dd34e88d07251f17913..1e2330012fb2b485606435957aa2e879c565a649 100644 (file)
@@ -211,16 +211,16 @@ void X11Factory::getMonitorInfo( const GenericWindow &rWindow,
     XineramaScreenInfo* info = XineramaQueryScreens( pDisplay, &num );
     if( info )
     {
+        Region reg1 = XCreateRegion();
+        XRectangle rect1 = { x, y, w, h };
+        XUnionRectWithRegion( &rect1, reg1, reg1 );
+
         unsigned int surface = 0;
         for( int i = 0; i < num; i++ )
         {
-            Region reg1 = XCreateRegion();
-            XRectangle rect1 = { info[i].x_org, info[i].y_org,
-                                 info[i].width, info[i].height };
-            XUnionRectWithRegion( &rect1, reg1, reg1 );
-
             Region reg2 = XCreateRegion();
-            XRectangle rect2 = { x, y, w, h };
+            XRectangle rect2 = { info[i].x_org, info[i].y_org,
+                                 info[i].width, info[i].height };
             XUnionRectWithRegion( &rect2, reg2, reg2 );
 
             Region reg = XCreateRegion();
@@ -236,7 +236,10 @@ void X11Factory::getMonitorInfo( const GenericWindow &rWindow,
                *p_width = info[i].width;
                *p_height = info[i].height;
             }
+            XDestroyRegion( reg );
+            XDestroyRegion( reg2 );
         }
+        XDestroyRegion( reg1 );
         XFree( info );
     }
 }