aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2012-11-30 18:48:47 +1000
committerDave Airlie <[email protected]>2012-12-04 17:55:52 +1000
commita853301fb7428138618cab67542e401afb808fbf (patch)
tree0996b0a436999997f9e6b8c0a15a418f28ae0fa6 /src/gallium/auxiliary/util
parentbdba4b30de15c4e7e6546f7eda37932d281f869c (diff)
u_cache: fix dereference before NULL check
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_cache.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_cache.c b/src/gallium/auxiliary/util/u_cache.c
index df08ec302a2..26aab2bf1d4 100644
--- a/src/gallium/auxiliary/util/u_cache.c
+++ b/src/gallium/auxiliary/util/u_cache.c
@@ -183,12 +183,12 @@ util_cache_set(struct util_cache *cache,
void *value)
{
struct util_cache_entry *entry;
- uint32_t hash = cache->hash(key);
+ uint32_t hash;
assert(cache);
if (!cache)
return;
-
+ hash = cache->hash(key);
entry = util_cache_entry_get(cache, hash, key);
if (!entry)
entry = cache->lru.prev;
@@ -218,12 +218,12 @@ util_cache_get(struct util_cache *cache,
const void *key)
{
struct util_cache_entry *entry;
- uint32_t hash = cache->hash(key);
+ uint32_t hash;
assert(cache);
if (!cache)
return NULL;
-
+ hash = cache->hash(key);
entry = util_cache_entry_get(cache, hash, key);
if (!entry)
return NULL;