egl/dri2: Check return value of __DRI2fence::create_fence()

If it returns NULL, then return early with an error.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Chad Versace 2015-05-05 19:05:20 -07:00
parent b8a1495106
commit b0f410a2a0
1 changed files with 7 additions and 0 deletions

View File

@ -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: