summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/egl_dri2.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2015-05-05 19:05:20 -0700
committerChad Versace <[email protected]>2015-05-06 07:55:41 -0700
commitb0f410a2a05e046c31c32e169b9463cb6b4af8ae (patch)
tree81d108f2cc8169798039af5151e35ea568ccd48d /src/egl/drivers/dri2/egl_dri2.c
parentb8a1495106a8b70e9026b7798a5df2fb9737c55e (diff)
egl/dri2: Check return value of __DRI2fence::create_fence()
If it returns NULL, then return early with an error. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2/egl_dri2.c')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c7
1 files changed, 7 insertions, 0 deletions
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: