intel: Fix memory leak in event of mip tree allocation failure
authorVinson Lee <vlee@vmware.com>
Wed, 28 Oct 2009 17:09:50 +0000 (11:09 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 28 Oct 2009 17:10:14 +0000 (11:10 -0600)
Signed-off-by: Brian Paul <brianp@vmware.com>
src/mesa/drivers/dri/intel/intel_mipmap_tree.c

index 0589d82..459e8fb 100644 (file)
@@ -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,