Mesa (master): cso: possible null pointer dereference

Zack Rusin zack at kemper.freedesktop.org
Tue Jul 7 01:40:12 UTC 2009


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

Author: Zack Rusin <zack at kde.org>
Date:   Sat Jun 20 21:25:47 2009 -0400

cso: possible null pointer dereference

reported by clang static analyzer

---

 src/gallium/auxiliary/cso_cache/cso_cache.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c
index 0bc77a5..e6dce3f 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.c
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.c
@@ -361,6 +361,10 @@ void cso_for_each_state(struct cso_cache *sc, enum cso_cache_type type,
 void cso_cache_delete(struct cso_cache *sc)
 {
    assert(sc);
+
+   if (!sc)
+      return;
+
    /* delete driver data */
    cso_for_each_state(sc, CSO_BLEND, delete_blend_state, 0);
    cso_for_each_state(sc, CSO_DEPTH_STENCIL_ALPHA, delete_depth_stencil_state, 0);




More information about the mesa-commit mailing list