From b0f410a2a05e046c31c32e169b9463cb6b4af8ae Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Tue, 5 May 2015 19:05:20 -0700 Subject: [PATCH] egl/dri2: Check return value of __DRI2fence::create_fence() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If it returns NULL, then return early with an error. Reviewed-by: Marek Olšák --- src/egl/drivers/dri2/egl_dri2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 1e843ed8fd9..8ed1dda38a6 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -2232,6 +2232,13 @@ dri2_create_sync(_EGLDriver *drv, _EGLDisplay *dpy, switch (type) { case EGL_SYNC_FENCE_KHR: dri2_sync->fence = dri2_dpy->fence->create_fence(dri2_ctx->dri_context); + if (!dri2_sync->fence) { + /* Why did it fail? DRI doesn't return an error code, so we emit + * a generic EGL error that doesn't communicate user error. */ + _eglError(EGL_BAD_ALLOC, "eglCreateSyncKHR"); + free(dri2_sync); + return NULL; + } break; case EGL_SYNC_CL_EVENT_KHR: -- 2.30.2