From 67e7263e4567f36e59009a1ca076a2854a6c1b0e Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Marchesin?= Date: Mon, 28 Jan 2013 15:04:00 -0800 Subject: [PATCH] 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 --- src/glx/dri2_glx.c | 8 +++++--- 1 file 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; } -- 2.30.2