u_blitter: Move a pointer dereference after null check.
authorVinson Lee <vlee@freedesktop.org>
Fri, 3 Aug 2012 06:28:10 +0000 (23:28 -0700)
committerVinson Lee <vlee@freedesktop.org>
Sat, 4 Aug 2012 05:27:13 +0000 (22:27 -0700)
Fixes dereference before null check defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
src/gallium/auxiliary/util/u_blitter.c

index b31ac2d5ceaff4cc5f082dce2269163b9396bfa9..22a828f4dee8a590b816efd4771648a6a1b171c8 100644 (file)
@@ -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? */