egl/x11: check the return value of xcb_dri2_get_buffers_reply()
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 5 Mar 2016 21:25:44 +0000 (21:25 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 9 Mar 2016 17:25:22 +0000 (17:25 +0000)
... before using it. The function can return NULL, which we should check
prior to refererencing it in the next function(s).

Cc: Fabian Vogt <fvogt@suse.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93667
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
src/egl/drivers/dri2/platform_x11.c

index 420f567651cb45464c678481023c4c37ee8b348e..3ab91886e011a6ff5ca04035fe589ba8e06beed8 100644 (file)
@@ -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;