From: Emil Velikov Date: Sat, 5 Mar 2016 21:25:44 +0000 (+0000) Subject: egl/x11: check the return value of xcb_dri2_get_buffers_reply() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b9c5c4af6dbfab28b1f0a78e41bffff1b2e06ce9;p=mesa.git egl/x11: check the return value of xcb_dri2_get_buffers_reply() ... before using it. The function can return NULL, which we should check prior to refererencing it in the next function(s). Cc: Fabian Vogt Cc: "11.1 11.2" Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93667 Signed-off-by: Emil Velikov Reviewed-by: Eduardo Lima Mitev --- diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 420f567651c..3ab91886e01 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1006,6 +1006,9 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, geometry_cookie = xcb_get_geometry (dri2_dpy->conn, drawable); buffers_reply = xcb_dri2_get_buffers_reply (dri2_dpy->conn, buffers_cookie, NULL); + if (buffers_reply == NULL) + return NULL; + buffers = xcb_dri2_get_buffers_buffers (buffers_reply); if (buffers == NULL) { return NULL;