intel: Fix memory leak in intel_miptree_create()
authorChad Versace <chad.versace@linux.intel.com>
Tue, 27 Dec 2011 18:10:05 +0000 (10:10 -0800)
committerChad Versace <chad.versace@linux.intel.com>
Thu, 29 Dec 2011 18:47:44 +0000 (10:47 -0800)
On failure, intel_miptree_create() needs to *release* the miptree, not
just free it, so that the stencil_mt gets released too.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/intel/intel_mipmap_tree.c

index 95764897d4fd27b50a8d72c3fc562a0ffd0cb22d..60cc694ee0cd917ad7c8c4887a84e22ae17ca7c8 100644 (file)
@@ -204,7 +204,7 @@ intel_miptree_create(struct intel_context *intel,
     * pitch == 0 || height == 0  indicates the null texture
     */
    if (!mt || !mt->total_width || !mt->total_height) {
-      free(mt);
+      intel_miptree_release(&mt);
       return NULL;
    }
 
@@ -216,7 +216,7 @@ intel_miptree_create(struct intel_context *intel,
                                   expect_accelerated_upload);
 
    if (!mt->region) {
-       free(mt);
+       intel_miptree_release(&mt);
        return NULL;
    }