Henri Verbeet : winex11.drv: Properly free "visinfo" in get_formats() ( Valgrind).

Alexandre Julliard julliard at winehq.org
Wed Oct 21 13:14:01 CDT 2009


Module: wine
Branch: master
Commit: ac14a2eec8851e349215eb7612295ed04ebe08d2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ac14a2eec8851e349215eb7612295ed04ebe08d2

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Oct 21 10:34:01 2009 +0200

winex11.drv: Properly free "visinfo" in get_formats() (Valgrind).

---

 dlls/winex11.drv/opengl.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 4e4a3a0..9f97099 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -906,7 +906,10 @@ static WineGLPixelFormat *get_formats(Display *display, int *size_ret, int *onsc
                  * with a depth of 32 in addition to the default 24 bit. In order to prevent BadMatch errors we only
                  * list formats with the same depth. */
                 if(visinfo->depth != screen_depth)
+                {
+                    XFree(visinfo);
                     continue;
+                }
 
                 TRACE("Found onscreen format FBCONFIG_ID 0x%x corresponding to iPixelFormat %d at GLX index %d\n", fmt_id, size+1, i);
                 list[size].iPixelFormat = size+1; /* The index starts at 1 */
@@ -931,8 +934,6 @@ static WineGLPixelFormat *get_formats(Display *display, int *size_ret, int *onsc
                     size++;
                     onscreen_size++;
                 }
-
-                XFree(visinfo);
             } else if(run && !visinfo) {
                 TRACE("Found offscreen format FBCONFIG_ID 0x%x corresponding to iPixelFormat %d at GLX index %d\n", fmt_id, size+1, i);
                 list[size].iPixelFormat = size+1; /* The index starts at 1 */
@@ -943,6 +944,8 @@ static WineGLPixelFormat *get_formats(Display *display, int *size_ret, int *onsc
                 list[size].dwFlags = 0;
                 size++;
             }
+
+            if (visinfo) XFree(visinfo);
         }
     }
 




More information about the wine-cvs mailing list