From: Stéphane Marchesin Date: Sun, 9 Oct 2011 23:49:19 +0000 (-0700) Subject: mesa/st: Check for a NULL _LinkedShader[i] before using it. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ddba509c16c4cb0630a4f4841b31953f02be6b3f;p=mesa.git mesa/st: Check for a NULL _LinkedShader[i] before using it. The rest of the linker/glsl translation code checks for NULL, so I suppose we should check here too. Fixes crash on exit with i915g instanced drawing. Reviewed-by: Ian Romanick --- diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index acd3b56b905..c419c4066a1 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -1154,7 +1154,8 @@ destroy_shader_program_variants_cb(GLuint key, void *data, void *userData) } for (i = 0; i < Elements(shProg->_LinkedShaders); i++) { - destroy_program_variants(st, shProg->_LinkedShaders[i]->Program); + if (shProg->_LinkedShaders[i]) + destroy_program_variants(st, shProg->_LinkedShaders[i]->Program); } } break;