summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/atifragshader.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2009-12-22 12:38:11 -0800
committerEric Anholt <[email protected]>2009-12-22 14:20:26 -0800
commitb08ed4f5955ef72309b6e20d865faf6d925c8c6e (patch)
treece4404bd282dbb84ef298711ccfdb1f0ecf8e50b /src/mesa/shader/atifragshader.c
parentfbeceec97b50a5e377a730d01d48c08faf8f6596 (diff)
mesa: Fix a NULL deref in glDeleteFragmentShaderATI(badname);
Fixes piglit ati-fs-bad-delete. Caught by clang.
Diffstat (limited to 'src/mesa/shader/atifragshader.c')
-rw-r--r--src/mesa/shader/atifragshader.c8
1 files changed, 5 insertions, 3 deletions
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);
+ }
}
}
}