[Mesa-dev] [PATCH] util: Move dereference after null check in util_resource_copy_region.
Vinson Lee
vlee at freedesktop.org
Fri Aug 3 23:42:33 PDT 2012
Fixes deference before null check defect reported by Coverity.
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
src/gallium/auxiliary/util/u_surface.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index a541a38..fcfff14 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;
--
1.7.11.1
More information about the mesa-dev
mailing list