Mesa (master): intel: Fix memory leak in event of mip tree allocation failure

Brian Paul brianp at kemper.freedesktop.org
Wed Oct 28 17:33:48 UTC 2009


Module: Mesa
Branch: master
Commit: a7d0665c00053839065592c339bfb298187a82be
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7d0665c00053839065592c339bfb298187a82be

Author: Vinson Lee <vlee at vmware.com>
Date:   Wed Oct 28 11:09:50 2009 -0600

intel: Fix memory leak in event of mip tree allocation failure

Signed-off-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/drivers/dri/intel/intel_mipmap_tree.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 0589d82..459e8fb 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,




More information about the mesa-commit mailing list