mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-22 16:20:40 +01:00
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 <juhapekka.heikkila@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
c692581ae8
commit
fb7baafbbf
1 changed files with 8 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue