From a7d0665c00053839065592c339bfb298187a82be Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 28 Oct 2009 11:09:50 -0600 Subject: [PATCH] intel: Fix memory leak in event of mip tree allocation failure Signed-off-by: Brian Paul --- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 0589d82db25..459e8fbd4b8 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -134,8 +134,10 @@ intel_miptree_create(struct intel_context *intel, /* * pitch == 0 || height == 0 indicates the null texture */ - if (!mt || !mt->pitch || !mt->total_height) + if (!mt || !mt->pitch || !mt->total_height) { + free(mt); return NULL; + } mt->region = intel_region_alloc(intel, tiling, -- 2.30.2