[Mesa-dev] [PATCH 10/11] meta: Fix error paths in meta_copy_image.c
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Mon Sep 8 23:53:49 PDT 2014
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 <juhapekka.heikkila at gmail.com>
---
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 0c204b8..fc0cbaf 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,
--
1.8.5.1
More information about the mesa-dev
mailing list