diff options
author | Juha-Pekka Heikkila <[email protected]> | 2014-02-13 16:04:23 +0200 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2014-05-30 09:22:34 +0300 |
commit | fb7baafbbf6d4e5d418d93a1a2cd222c3ae3aae6 (patch) | |
tree | 5a80f796486d9a49c6a72ad68c8536904e18bb56 /src/mesa/program | |
parent | c692581ae870f73f93993ba05a4d28ab0ef8e7bd (diff) |
mesa: Add missing null checks into prog_hash_table.c
Check calloc return values in hash_table_insert() and
hash_table_replace()
Signed-off-by: Juha-Pekka Heikkila <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r-- | src/mesa/program/prog_hash_table.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/program/prog_hash_table.c b/src/mesa/program/prog_hash_table.c index f45ed46afad..2445d843446 100644 --- a/src/mesa/program/prog_hash_table.c +++ b/src/mesa/program/prog_hash_table.c @@ -142,6 +142,10 @@ hash_table_insert(struct hash_table *ht, void *data, const void *key) struct hash_node *node; node = calloc(1, sizeof(*node)); + if (node == NULL) { + _mesa_error_no_memory(__func__); + return; + } node->data = data; node->key = key; @@ -167,6 +171,10 @@ hash_table_replace(struct hash_table *ht, void *data, const void *key) } hn = calloc(1, sizeof(*hn)); + if (hn == NULL) { + _mesa_error_no_memory(__func__); + return false; + } hn->data = data; hn->key = key; |