i965: fix resource leak
authorEric Engestrom <eric@engestrom.ch>
Sun, 10 Jun 2018 17:42:45 +0000 (18:42 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Mon, 11 Jun 2018 13:54:23 +0000 (14:54 +0100)
v2: intel_miptree_release() already takes care of the planes, no need
    to hand-code the loop (Lionel)

Coverity ID: 1436909
Fixes: 3352f2d746d3959b22ca4 "i965: Create multiple miptrees for planar YUV images"
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index 69024c0678bedc3a6d2c130d618a444ef4a8bc9b..6b89bf6848afb7c969b65c2c226576087ce9e4e9 100644 (file)
@@ -927,8 +927,10 @@ miptree_create_for_planar_image(struct brw_context *brw,
                                      image->strides[index],
                                      tiling,
                                      MIPTREE_CREATE_NO_AUX);
-      if (mt == NULL)
+      if (mt == NULL) {
+         intel_miptree_release(&planar_mt);
          return NULL;
+      }
 
       mt->target = target;