From 3e7b3a04bf7667583dac18f1267d213aa7f33800 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 3 Aug 2012 23:38:29 -0700 Subject: util: Move dereference after null check in util_resource_copy_region. Fixes dereference before null check defect reported by Coverity. Signed-off-by: Vinson Lee Reviewed-by: Brian Paul --- src/gallium/auxiliary/util/u_surface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gallium/auxiliary') diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index a541a38ffa1..fcfff148fe4 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -160,12 +160,12 @@ util_resource_copy_region(struct pipe_context *pipe, unsigned h = src_box->height; assert(src && dst); - assert((src->target == PIPE_BUFFER && dst->target == PIPE_BUFFER) || - (src->target != PIPE_BUFFER && dst->target != PIPE_BUFFER)); - if (!src || !dst) return; + assert((src->target == PIPE_BUFFER && dst->target == PIPE_BUFFER) || + (src->target != PIPE_BUFFER && dst->target != PIPE_BUFFER)); + src_format = src->format; dst_format = dst->format; -- cgit v1.2.3