From b9463813eeffbe3b03fbf681d0283a40ce84619a Mon Sep 17 00:00:00 2001 From: Juha-Pekka Heikkila Date: Mon, 8 Sep 2014 13:59:50 +0300 Subject: [PATCH] meta: Fix error paths in meta_copy_image.c If _mesa_get_tex_image() return NULL there is already error set in context. Other error pats free allocated texture. Signed-off-by: Juha-Pekka Heikkila Reviewed-by: Anuj Phogat --- src/mesa/drivers/common/meta_copy_image.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mesa/drivers/common/meta_copy_image.c b/src/mesa/drivers/common/meta_copy_image.c index 0c204b87d65..fc0cbaf1bd8 100644 --- a/src/mesa/drivers/common/meta_copy_image.c +++ b/src/mesa/drivers/common/meta_copy_image.c @@ -63,12 +63,21 @@ make_view(struct gl_context *ctx, struct gl_texture_image *tex_image, if (!ctx->Driver.TestProxyTexImage(ctx, tex_obj->Target, 0, tex_format, tex_image->Width, tex_image->Height, tex_image->Depth, 0)) { + _mesa_DeleteTextures(1, view_tex_name); + *view_tex_name = 0; return false; } view_tex_obj->Target = tex_obj->Target; *view_tex_image = _mesa_get_tex_image(ctx, view_tex_obj, tex_obj->Target, 0); + + if (!*view_tex_image) { + _mesa_DeleteTextures(1, view_tex_name); + *view_tex_name = 0; + return false; + } + _mesa_init_teximage_fields(ctx, *view_tex_image, tex_image->Width, tex_image->Height, tex_image->Depth, -- 2.30.2