[Mesa-dev] [PATCH] radeon: Reference miptree after checking if it is null.
Vinson Lee
vlee at freedesktop.org
Sat Oct 26 09:23:51 CEST 2013
Fixes "Dereference before null check" defect reported by Coverity.
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
src/mesa/drivers/dri/radeon/radeon_texture.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 52cf95d..1ce6d28 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -560,8 +560,6 @@ void radeon_image_target_texture_2d(struct gl_context *ctx, GLenum target,
radeon_try_alloc_miptree(radeon, t);
- radeon_miptree_reference(t->mt, &radeonImage->mt);
-
if (t->mt == NULL)
{
radeon_print(RADEON_TEXTURE, RADEON_VERBOSE,
@@ -569,6 +567,8 @@ void radeon_image_target_texture_2d(struct gl_context *ctx, GLenum target,
return;
}
+ radeon_miptree_reference(t->mt, &radeonImage->mt);
+
/* Particularly ugly: this is guaranteed to break, if image->bo is
not of the required size for a miptree. */
radeon_bo_unref(t->mt->bo);
--
1.8.3.1
More information about the mesa-dev
mailing list