Mesa (master): u_blitter: Move a pointer dereference after null check.

Vinson Lee vlee at kemper.freedesktop.org
Sat Aug 4 05:27:50 UTC 2012


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

Author: Vinson Lee <vlee at freedesktop.org>
Date:   Thu Aug  2 23:28:10 2012 -0700

u_blitter: Move a pointer dereference after null check.

Fixes dereference before null check defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Reviewed-by: Marek Olšák <maraeo at gmail.com>

---

 src/gallium/auxiliary/util/u_blitter.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index b31ac2d..22a828f 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -941,14 +941,15 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
    struct pipe_sampler_view src_templ, *src_view;
    unsigned bind;
    boolean is_stencil, is_depth;
-   const struct util_format_description *src_desc =
-         util_format_description(src->format);
+   const struct util_format_description *src_desc;
 
    /* Give up if textures are not set. */
    assert(dst && src);
    if (!dst || !src)
       return;
 
+   src_desc = util_format_description(src->format);
+
    assert(src->target < PIPE_MAX_TEXTURE_TYPES);
 
    /* Is this a ZS format? */




More information about the mesa-commit mailing list