mesa: Fix a NULL deref in glDeleteFragmentShaderATI(badname);
authorEric Anholt <eric@anholt.net>
Tue, 22 Dec 2009 20:38:11 +0000 (12:38 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 22 Dec 2009 22:20:26 +0000 (14:20 -0800)
Fixes piglit ati-fs-bad-delete.  Caught by clang.

src/mesa/shader/atifragshader.c

index ac087d415c5df2f829c5bf80bd8d8e946b978fa0..e04a05b22fff0ca5ccf7c6d2300293f11b52f3b0 100644 (file)
@@ -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);
+        }
       }
    }
 }