From: Stéphane Marchesin Date: Mon, 28 Jan 2013 23:04:00 +0000 (-0800) Subject: glx: Check that swap_buffers_reply is non-NULL before using it X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=67e7263e4567f36e59009a1ca076a2854a6c1b0e;p=mesa.git 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 --- 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; }