x11/gl: Fix use after free
authorOlivier Fourdan <fourdan@xfce.org>
Fri, 3 Apr 2015 15:51:57 +0000 (17:51 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 5 Apr 2015 11:41:03 +0000 (07:41 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=747305

Signed-off-by: Olivier Fourdan <fourdan@xfce.org>
gdk/x11/gdkglcontext-x11.c

index 9bf8cc37af83858c9789d334b8bbd786494e0d42..c86cbd5a690e7368546c90224cd948fad1a816a8 100644 (file)
@@ -309,9 +309,9 @@ glx_pixmap_get (cairo_surface_t *surface, guint texture_target)
 {
   Display *display = cairo_xlib_surface_get_display (surface);
   Screen *screen = cairo_xlib_surface_get_screen (surface);
-  Visual *visual = cairo_xlib_surface_get_visual (surface);;
+  Visual *visual = cairo_xlib_surface_get_visual (surface);
   GdkGLXPixmap *glx_pixmap;
-  GLXFBConfig *fbconfigs;
+  GLXFBConfig *fbconfigs, config;
   int nfbconfigs;
   XVisualInfo *visinfo;
   VisualID visualid;
@@ -393,6 +393,7 @@ glx_pixmap_get (cairo_surface_t *surface, guint texture_target)
       if (value == TRUE)
         y_inverted = TRUE;
 
+      config = fbconfigs[i];
       break;
     }
 
@@ -407,7 +408,7 @@ glx_pixmap_get (cairo_surface_t *surface, guint texture_target)
   glx_pixmap = g_slice_new0 (GdkGLXPixmap);
   glx_pixmap->y_inverted = y_inverted;
   glx_pixmap->display = display;
-  glx_pixmap->drawable = glXCreatePixmap (display, fbconfigs[i],
+  glx_pixmap->drawable = glXCreatePixmap (display, config,
                                          cairo_xlib_surface_get_drawable (surface),
                                          pixmap_attributes);