[Mesa-dev] [PATCH 05/13] mesa/program: Don't clear caches which are not allocated

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Tue May 5 04:25:21 PDT 2015


Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/mesa/program/prog_cache.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/mesa/program/prog_cache.c b/src/mesa/program/prog_cache.c
index ed93af7..eef5339 100644
--- a/src/mesa/program/prog_cache.c
+++ b/src/mesa/program/prog_cache.c
@@ -156,18 +156,22 @@ _mesa_new_program_cache(void)
 void
 _mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *cache)
 {
-   clear_cache(ctx, cache, GL_FALSE);
-   free(cache->items);
-   free(cache);
+   if (cache) {
+      clear_cache(ctx, cache, GL_FALSE);
+      free(cache->items);
+      free(cache);
+   }
 }
 
 void
 _mesa_delete_shader_cache(struct gl_context *ctx,
 			  struct gl_program_cache *cache)
 {
-   clear_cache(ctx, cache, GL_TRUE);
-   free(cache->items);
-   free(cache);
+   if (cache) {
+      clear_cache(ctx, cache, GL_TRUE);
+      free(cache->items);
+      free(cache);
+   }
 }
 
 
-- 
1.8.5.1



More information about the mesa-dev mailing list