st/egl: Do not finish a fence that is NULL.
authorChia-I Wu <olv@lunarg.com>
Thu, 14 Oct 2010 09:13:36 +0000 (17:13 +0800)
committerChia-I Wu <olv@lunarg.com>
Thu, 14 Oct 2010 09:16:14 +0000 (17:16 +0800)
i915g would dereference the NULL pointer.

src/gallium/state_trackers/egl/common/egl_g3d_api.c

index c0164daf9c1e210c9d65ea6f83cc4b593a785400..3bde39737ba2d7675c43d4a2850b582e3d57c4bb 100644 (file)
@@ -609,8 +609,10 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
 
    gctx->stctxi->flush(gctx->stctxi,
          PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
-   screen->fence_finish(screen, fence, 0);
-   screen->fence_reference(screen, &fence, NULL);
+   if (fence) {
+      screen->fence_finish(screen, fence, 0);
+      screen->fence_reference(screen, &fence, NULL);
+   }
 
    return EGL_TRUE;
 }