]> git.sesse.net Git - vlc/commitdiff
* modules/video_output/x11/xcommon.c: proper fix for the previous memory leak.
authorGildas Bazin <gbazin@videolan.org>
Sun, 8 Oct 2006 18:39:01 +0000 (18:39 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 8 Oct 2006 18:39:01 +0000 (18:39 +0000)
modules/video_output/x11/xcommon.c

index f481b487ebb6747adb68bc2691a9453d589ea3b9..1db49ddf90de166b7ff1ec99bdda1e384277288c 100644 (file)
@@ -1996,7 +1996,7 @@ static int InitDisplay( vout_thread_t *p_vout )
     XPixmapFormatValues *       p_formats;                 /* pixmap formats */
     XVisualInfo *               p_xvisual;            /* visuals information */
     XVisualInfo                 xvisual_template;         /* visual template */
-    int                         i_count;                       /* array size */
+    int                         i_count, i;                    /* array size */
 #endif
 
 #ifdef HAVE_SYS_SHM_H
@@ -2102,18 +2102,18 @@ static int InitDisplay( vout_thread_t *p_vout )
         p_formats = XListPixmapFormats( p_vout->p_sys->p_display, &i_count );
         p_vout->p_sys->i_bytes_per_pixel = 0;
 
-        for( ; i_count-- ; p_formats++ )
+        for( i = 0; i < i_count; i++ )
         {
             /* Under XFree4.0, the list contains pixmap formats available
              * through all video depths ; so we have to check against current
              * depth. */
-            if( p_formats->depth == (int)p_vout->p_sys->i_screen_depth )
+            if( p_formats[i].depth == (int)p_vout->p_sys->i_screen_depth )
             {
-                if( p_formats->bits_per_pixel / 8
+                if( p_formats[i].bits_per_pixel / 8
                         > (int)p_vout->p_sys->i_bytes_per_pixel )
                 {
                     p_vout->p_sys->i_bytes_per_pixel =
-                                               p_formats->bits_per_pixel / 8;
+                        p_formats[i].bits_per_pixel / 8;
                 }
             }
         }