summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/dri2.c
diff options
context:
space:
mode:
authorNicholas Bishop <[email protected]>2016-09-22 16:04:13 +0100
committerEmil Velikov <[email protected]>2016-09-27 13:37:21 +0100
commitaa560e8e6328acd5b8feec1fea54dec06ae21368 (patch)
tree8be83a371cfd9e2ebf04d97f916a0175d6b0f72e /src/gallium/state_trackers/dri/dri2.c
parent2d05ba2ca0af336ceae3167432d7df9df3366b74 (diff)
st/dri: check pipe_screen->resource_get_handle() return value
Change dri2_query_image to check the return value of resource_get_handle and return GL_FALSE if an error occurs. For reference this is an example callstack that should propagate the error back to the user: i915_drm_buffer_get_handle i915_texture_get_handle u_resource_get_handle_vtbl dri2_query_image gbm_dri_bo_get_fd gbm_bo_get_fd Cc: [email protected] Signed-off-by: Nicholas Bishop <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (v1) [Emil Velikov: Split from larger patch, polish coding style, cc stable] Signed-off-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/dri/dri2.c')
-rw-r--r--src/gallium/state_trackers/dri/dri2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index a22e7ee6ace..64d9c3ed408 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1055,8 +1055,10 @@ dri2_query_image(__DRIimage *image, int attrib, int *value)
return GL_TRUE;
case __DRI_IMAGE_ATTRIB_FD:
whandle.type= DRM_API_HANDLE_TYPE_FD;
- image->texture->screen->resource_get_handle(image->texture->screen,
- NULL, image->texture, &whandle, usage);
+ if (!image->texture->screen->resource_get_handle(image->texture->screen,
+ NULL, image->texture, &whandle, usage))
+ return GL_FALSE;
+
*value = whandle.handle;
return GL_TRUE;
case __DRI_IMAGE_ATTRIB_FORMAT: