diff options
author | Ilia Mirkin <[email protected]> | 2016-02-03 13:51:19 -0500 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-02-03 18:40:13 -0500 |
commit | 9284fd9c0d1855b1236d9630f3888f6320d9d7a8 (patch) | |
tree | aadfc221b688e41738cfabf1c2d17886475f4b5f /src | |
parent | 5ac7f0433b17acc6587b87ce25adb6975c04eb27 (diff) |
st/mesa: fix potential null deref if no shader is passed in
Spotted by Coverity
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_atom_storagebuf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_atom_storagebuf.c b/src/mesa/state_tracker/st_atom_storagebuf.c index a581818d8c0..f165cc3e0a1 100644 --- a/src/mesa/state_tracker/st_atom_storagebuf.c +++ b/src/mesa/state_tracker/st_atom_storagebuf.c @@ -46,11 +46,13 @@ st_bind_ssbos(struct st_context *st, struct gl_shader *shader, { unsigned i; struct pipe_shader_buffer buffers[MAX_SHADER_STORAGE_BUFFERS]; - struct gl_program_constants *c = &st->ctx->Const.Program[shader->Stage]; + struct gl_program_constants *c; if (!shader || !st->pipe->set_shader_buffers) return; + c = &st->ctx->Const.Program[shader->Stage]; + for (i = 0; i < shader->NumShaderStorageBlocks; i++) { struct gl_shader_storage_buffer_binding *binding; struct st_buffer_object *st_obj; |