From: Vinson Lee Date: Sat, 4 Aug 2012 06:38:29 +0000 (-0700) Subject: util: Move dereference after null check in util_resource_copy_region. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3e7b3a04bf7667583dac18f1267d213aa7f33800;p=mesa.git 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 --- 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;