Mesa (master): mesa: Fix a NULL deref in glDeleteFragmentShaderATI(badname) ;

Eric Anholt anholt at kemper.freedesktop.org
Tue Dec 22 14:21:04 PST 2009


Module: Mesa
Branch: master
Commit: b08ed4f5955ef72309b6e20d865faf6d925c8c6e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b08ed4f5955ef72309b6e20d865faf6d925c8c6e

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Dec 22 12:38:11 2009 -0800

mesa: Fix a NULL deref in glDeleteFragmentShaderATI(badname);

Fixes piglit ati-fs-bad-delete.  Caught by clang.

---

 src/mesa/shader/atifragshader.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/shader/atifragshader.c
index ac087d4..e04a05b 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);
+	 }
       }
    }
 }



More information about the mesa-commit mailing list