summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/cso_cache/cso_cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/cso_cache/cso_cache.c')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c
index 18acab0967..63464e0705 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.c
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.c
@@ -290,6 +290,8 @@ void * cso_take_state(struct cso_cache *sc,
struct cso_cache *cso_cache_create(void)
{
struct cso_cache *sc = MALLOC_STRUCT(cso_cache);
+ if (sc == NULL)
+ return NULL;
sc->max_size = 4096;
sc->blend_hash = cso_hash_create();
@@ -332,10 +334,10 @@ void cso_for_each_state(struct cso_cache *sc, enum cso_cache_type type,
iter = cso_hash_first_node(hash);
while (!cso_hash_iter_is_null(iter)) {
void *state = cso_hash_iter_data(iter);
+ iter = cso_hash_iter_next(iter);
if (state) {
func(state, user_data);
}
- iter = cso_hash_iter_next(iter);
}
}