From: Eric Anholt Date: Tue, 22 Dec 2009 20:38:11 +0000 (-0800) Subject: mesa: Fix a NULL deref in glDeleteFragmentShaderATI(badname); X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b08ed4f5955ef72309b6e20d865faf6d925c8c6e;p=mesa.git mesa: Fix a NULL deref in glDeleteFragmentShaderATI(badname); Fixes piglit ati-fs-bad-delete. Caught by clang. --- diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/shader/atifragshader.c index ac087d415c5..e04a05b22ff 100644 --- a/src/mesa/shader/atifragshader.c +++ b/src/mesa/shader/atifragshader.c @@ -290,9 +290,11 @@ _mesa_DeleteFragmentShaderATI(GLuint id) /* The ID is immediately available for re-use now */ _mesa_HashRemove(ctx->Shared->ATIShaders, id); - prog->RefCount--; - if (prog->RefCount <= 0) { - _mesa_free(prog); + if (prog) { + prog->RefCount--; + if (prog->RefCount <= 0) { + _mesa_free(prog); + } } } }