From: Robert Foss <robert.f...@collabora.com>

Make sure that fd2_program_validate does not fail. If it does fail, some of
shader data structes may be de-allocated.

Also fd2_draw_vbo to return booleans to indicate failure.

coverity: 1362467
Signed-off-by: Robert Foss <robert.f...@collabora.com>
---
 src/gallium/drivers/freedreno/a2xx/fd2_emit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c 
b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
index 4f667ab..edf0e7e 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
@@ -179,7 +179,7 @@ fd2_emit_vertex_bufs(struct fd_ringbuffer *ring, uint32_t 
val,
        }
 }
 
-void
+bool
 fd2_emit_state(struct fd_context *ctx, uint32_t dirty)
 {
        struct fd2_blend_stateobj *blend = fd2_blend_stateobj(ctx->blend);
@@ -278,7 +278,8 @@ fd2_emit_state(struct fd_context *ctx, uint32_t dirty)
        }
 
        if (dirty & (FD_DIRTY_PROG | FD_DIRTY_VTXSTATE | FD_DIRTY_TEXSTATE)) {
-               fd2_program_validate(ctx);
+               if (fd2_program_validate(ctx) == false)
+                       return false;
                fd2_program_emit(ring, &ctx->prog);
        }
 
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to