On 10/06/18 18:42, Eric Engestrom wrote:
Coverity ID: 1436909
Fixes: 3352f2d746d3959b22ca4 "i965: Create multiple miptrees for planar YUV 
images"
Signed-off-by: Eric Engestrom <[email protected]>
---
  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 69024c0678bedc3a6d2c..d678d615b9080e5f2c7f 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -907,8 +907,9 @@ miptree_create_for_planar_image(struct brw_context *brw,
  {
     const struct intel_image_format *f = image->planar_format;
     struct intel_mipmap_tree *planar_mt = NULL;
+   int i;
- for (int i = 0; i < f->nplanes; i++) {
+   for (i = 0; i < f->nplanes; i++) {
        const int index = f->planes[i].buffer_index;
        const uint32_t dri_format = f->planes[i].dri_format;
        const mesa_format format = driImageFormatToGLFormat(dri_format);
@@ -928,7 +929,7 @@ miptree_create_for_planar_image(struct brw_context *brw,
                                       tiling,
                                       MIPTREE_CREATE_NO_AUX);
        if (mt == NULL)
-         return NULL;
+         goto fail;
mt->target = target; @@ -941,6 +942,13 @@ miptree_create_for_planar_image(struct brw_context *brw,
     planar_mt->drm_modifier = image->modifier;
return planar_mt;
+
+fail:
+   while (i--) {
+      intel_miptree_release(&planar_mt->plane[i]);
+   }
+   intel_miptree_release(&planar_mt);

intel_miptree_release(&planar_mt); seems to release it's planes, so why not just that? :

if (mt == NULL) {
    intel_miptree_release(&planar_mt);
    return NULL;
}

+   return NULL;
  }
static bool


_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to