summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVinson Lee <vlee@freedesktop.org>2012-08-03 23:38:29 -0700
committerVinson Lee <vlee@freedesktop.org>2012-08-04 21:41:27 -0700
commit3e7b3a04bf7667583dac18f1267d213aa7f33800 (patch)
treeb4acd89fb6d8604ac1dc762c915d73ed301cca05 /src
parenta5ca29100bd64f47e24ad1bd8ae04f0007021541 (diff)
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 <vlee@freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_surface.c6
1 files changed, 3 insertions, 3 deletions
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;