[vlc-commits] skins2: fix memory leak regarding previous commit

Erwan Tulou git at videolan.org
Thu Jun 9 22:31:54 CEST 2011


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Jun  9 22:18:42 2011 +0200| [73b7ccdfc639b70e5d838a09ad3abee4cbfaac93] | committer: Erwan Tulou

skins2: fix memory leak regarding previous commit

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=73b7ccdfc639b70e5d838a09ad3abee4cbfaac93
---

 modules/gui/skins2/x11/x11_factory.cpp |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/modules/gui/skins2/x11/x11_factory.cpp b/modules/gui/skins2/x11/x11_factory.cpp
index fca747e..1e23300 100644
--- a/modules/gui/skins2/x11/x11_factory.cpp
+++ b/modules/gui/skins2/x11/x11_factory.cpp
@@ -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 );
     }
 }



More information about the vlc-commits mailing list