summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Marchesin <[email protected]>2013-01-28 15:04:00 -0800
committerStéphane Marchesin <[email protected]>2013-01-29 11:15:22 -0800
commit67e7263e4567f36e59009a1ca076a2854a6c1b0e (patch)
tree5d267ce47a45c72ad9f4bcf18fbdeeeb18680043
parent70c5297439cc5401045ec842a6abeda118296f69 (diff)
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 <[email protected]>
-rw-r--r--src/glx/dri2_glx.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index a51716fedb9..78a2a42ddab 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;
}