Module: Mesa
Branch: master
Commit: 67e7263e4567f36e59009a1ca076a2854a6c1b0e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=67e7263e4567f36e59009a1ca076a2854a6c1b0e

Author: Stéphane Marchesin <marc...@chromium.org>
Date:   Mon Jan 28 15:04:00 2013 -0800

glx: Check that swap_buffers_reply is non-NULL before using it

Check that the return value from xcb_dri2_swap_buffers_reply is
non-NULL before accessing the struct members.

Note: This is a candidate for the 9.0 branch.

Reviewed-by: Brian Paul <bri...@vmware.com>

---

 src/glx/dri2_glx.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index a51716f..78a2a42 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -789,9 +789,11 @@ dri2XcbSwapBuffers(Display *dpy,
 
    swap_buffers_reply =
       xcb_dri2_swap_buffers_reply(c, swap_buffers_cookie, NULL);
-   ret = merge_counter(swap_buffers_reply->swap_hi,
-                       swap_buffers_reply->swap_lo);
-   free(swap_buffers_reply);
+   if (swap_buffers_reply) {
+      ret = merge_counter(swap_buffers_reply->swap_hi,
+                          swap_buffers_reply->swap_lo);
+      free(swap_buffers_reply);
+   }
    return ret;
 }
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to