[Mesa-dev] [PATCH 4/6] util: in _mesa_set_create() mark error if out of memory

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Mon Jan 26 01:07:49 PST 2015


added calls to _mesa_error_no_memory() if memory allocation
returned null pointer.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/util/set.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/util/set.c b/src/util/set.c
index c3252a0..b0baccc 100644
--- a/src/util/set.c
+++ b/src/util/set.c
@@ -38,6 +38,7 @@
 #include "macros.h"
 #include "ralloc.h"
 #include "set.h"
+#include "main/errors.h"
 
 /*
  * From Knuth -- a good choice for hash/rehash values is p, p-2 where
@@ -111,8 +112,10 @@ _mesa_set_create(void *mem_ctx,
    struct set *ht;
 
    ht = ralloc(mem_ctx, struct set);
-   if (ht == NULL)
+   if (ht == NULL) {
+      _mesa_error_no_memory(__func__);
       return NULL;
+   }
 
    ht->size_index = 0;
    ht->size = hash_sizes[ht->size_index].size;
@@ -125,6 +128,7 @@ _mesa_set_create(void *mem_ctx,
    ht->deleted_entries = 0;
 
    if (ht->table == NULL) {
+      _mesa_error_no_memory(__func__);
       ralloc_free(ht);
       return NULL;
    }
-- 
1.8.5.1



More information about the mesa-dev mailing list