From: Kristian Høgsberg Date: Fri, 13 Feb 2009 16:05:54 +0000 (-0500) Subject: intel: Fix intelSetTexBuffer miptree leak. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5b354d39d466e3a463c6766fe06f737aa6e6b7bd;p=mesa.git intel: Fix intelSetTexBuffer miptree leak. The intelImage also holds a reference to the miptree, so unref that as well. --- diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index c3bbcfc1b97..943636c37b2 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -755,16 +755,21 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) _mesa_lock_texture(&intel->ctx, texObj); + texImage = _mesa_get_tex_image(&intel->ctx, texObj, target, level); + intelImage = intel_texture_image(texImage); + + if (intelImage->mt) { + intel_miptree_release(intel, &intelImage->mt); + assert(!texImage->Data); + } if (intelObj->mt) intel_miptree_release(intel, &intelObj->mt); intelObj->mt = mt; - texImage = _mesa_get_tex_image(&intel->ctx, texObj, target, level); _mesa_init_teximage_fields(&intel->ctx, target, texImage, rb->region->width, rb->region->height, 1, 0, internalFormat); - intelImage = intel_texture_image(texImage); intelImage->face = target_to_face(target); intelImage->level = level; texImage->TexFormat = intelChooseTextureFormat(&intel->ctx, internalFormat,