Mesa (master): intel: Don't leak the tex object miptree when replacing it

Ian Romanick idr at kemper.freedesktop.org
Tue Mar 29 03:18:44 UTC 2011


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Mar 28 10:13:25 2011 -0700

intel: Don't leak the tex object miptree when replacing it

Eventually the miptree refcounting interface should be cleaned up.
The assymmetry dramatically increases the probability of bugs like
this.  It should be made to like like libdrm refcounting or the
refcounting style used in other parts of Mesa.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=33046

Reviewed-by: Eric Anholt <eric at anholt.net>

---

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

diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 906f8a6..b3a2b1b 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -370,8 +370,10 @@ intelTexImage(struct gl_context * ctx,
        * whole object since our level didn't fit what was there
        * before, and any lower levels would fit into our miptree.
        */
-      if (intelImage->mt)
+      if (intelImage->mt) {
+	 intel_miptree_release(intel, &intelObj->mt);
 	 intel_miptree_reference(&intelObj->mt, intelImage->mt);
+      }
    }
 
    /* PBO fastpaths:




More information about the mesa-commit mailing list