summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJuha-Pekka Heikkila <[email protected]>2014-09-08 13:59:50 +0300
committerTapani Pälli <[email protected]>2014-09-23 10:25:02 +0300
commitb9463813eeffbe3b03fbf681d0283a40ce84619a (patch)
tree72378803ffbbd7764b6663a8d23892d4b607516f /src/mesa
parente13a8dc37dde097710ea13bef24c022b263ea1eb (diff)
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 <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/common/meta_copy_image.c9
1 files changed, 9 insertions, 0 deletions
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,