[Mesa-dev] [PATCH 2/4] secure malloc in translate_cache_create

Tim Wiederhake twied at gmx.net
Mon Jan 24 07:59:15 PST 2011


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

diff --git a/src/gallium/auxiliary/translate/translate_cache.c b/src/gallium/auxiliary/translate/translate_cache.c
index d8069a1..3f1ecb6 100644
--- a/src/gallium/auxiliary/translate/translate_cache.c
+++ b/src/gallium/auxiliary/translate/translate_cache.c
@@ -40,6 +40,10 @@ struct translate_cache {
 struct translate_cache * translate_cache_create( void )
 {
    struct translate_cache *cache = MALLOC_STRUCT(translate_cache);
+   if (cache == NULL) {
+      return NULL;
+   }
+
    cache->hash = cso_hash_create();
    return cache;
 }
-- 
1.7.2.3



More information about the mesa-dev mailing list