st/mesa: release EGLImage on EGLImageTarget* error

The smapi->get_egl_image() call in st_egl_image_get_surface() stores a
reference to the EGLImage's texture in stimg.texture. That reference is
released via pipe_resource_reference(&stimg.texture, NULL) before stimg
goes out of scope at the end of the function, but not in the error path
if !is_format_supported().

Fixes: 83e9de25f3 ("st/mesa: EGLImageTarget* error handling")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Philipp Zabel 2017-06-30 10:39:53 +02:00 committed by Lucas Stach
parent 2c240a7205
commit 7d7bcd65d6
1 changed files with 1 additions and 0 deletions

View File

@ -96,6 +96,7 @@ st_egl_image_get_surface(struct gl_context *ctx, GLeglImageOES image_handle,
if (!is_format_supported(screen, stimg.format, stimg.texture->nr_samples, usage)) {
/* unable to specify a texture object using the specified EGL image */
pipe_resource_reference(&stimg.texture, NULL);
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(format not supported)", error);
return NULL;
}