Mesa (master): secure malloc in translate_cache_create

Brian Paul brianp at kemper.freedesktop.org
Mon Jan 24 16:19:33 UTC 2011


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

Author: Tim Wiederhake <twied at gmx.net>
Date:   Mon Jan 24 07:59:15 2011 -0800

secure malloc in translate_cache_create

Signed-off-by: Brian Paul <brianp at vmware.com>

---

 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;
 }




More information about the mesa-commit mailing list