From b08ed4f5955ef72309b6e20d865faf6d925c8c6e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 22 Dec 2009 12:38:11 -0800 Subject: mesa: Fix a NULL deref in glDeleteFragmentShaderATI(badname); Fixes piglit ati-fs-bad-delete. Caught by clang. --- src/mesa/shader/atifragshader.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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); + } } } } -- cgit v1.2.3