draw: Add a null check for draw.
authorVinson Lee <vlee@freedesktop.org>
Sat, 28 Sep 2013 04:46:33 +0000 (21:46 -0700)
committerVinson Lee <vlee@freedesktop.org>
Tue, 1 Oct 2013 04:46:42 +0000 (21:46 -0700)
There is an earlier null check for draw so draw could be null here as
well.

Fixes "Dereference after null check" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/draw/draw_pipe_unfilled.c

index 7a88ce0f6d70f0b4a71120f26cd2248f663601e1..8cba07c34bc8c825e46b4767fd865f20fbbf8c89 100644 (file)
@@ -237,7 +237,7 @@ draw_unfilled_prepare_outputs( struct draw_context *draw,
    boolean is_unfilled = (rast &&
                           (rast->fill_front != PIPE_POLYGON_MODE_FILL ||
                            rast->fill_back != PIPE_POLYGON_MODE_FILL));
-   const struct draw_fragment_shader *fs = draw->fs.fragment_shader;
+   const struct draw_fragment_shader *fs = draw ? draw->fs.fragment_shader : 0;
 
    if (is_unfilled && fs && fs->info.uses_frontface)  {
       unfilled->face_slot = draw_alloc_extra_vertex_attrib(