[Mesa-stable] [PATCH] i915, i965: Fix memory leak in try_pbo_upload (v2)

Chad Versace chad.versace at linux.intel.com
Thu Aug 15 10:40:01 PDT 2013


From: Vinson Lee <vlee at freedesktop.org>

Fixes "Resource leak" defect reported by Coverity.
Tested on Haswell, no Piglit regressions.

v2: Apply to i965, not just i915. (chadv)

CC: "9.2, 9.1" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/mesa/drivers/dri/i915/intel_tex_image.c | 1 +
 src/mesa/drivers/dri/i965/intel_tex_image.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/i915/intel_tex_image.c b/src/mesa/drivers/dri/i915/intel_tex_image.c
index 9b1336d..975e77a 100644
--- a/src/mesa/drivers/dri/i915/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i915/intel_tex_image.c
@@ -171,6 +171,7 @@ try_pbo_upload(struct gl_context *ctx,
                            0, 0, false,
                            image->Width, image->Height, GL_COPY)) {
       DBG("%s: blit failed\n", __FUNCTION__);
+      intel_miptree_release(&pbo_mt);
       return false;
    }
 
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index 7db0deb..f270862 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -173,6 +173,7 @@ try_pbo_upload(struct gl_context *ctx,
                            0, 0, false,
                            image->Width, image->Height, GL_COPY)) {
       DBG("%s: blit failed\n", __FUNCTION__);
+      intel_miptree_release(&pbo_mt);
       return false;
    }
 
-- 
1.8.3.1



More information about the mesa-stable mailing list