Hashmap: Check for failure of first malloc.
This commit is contained in:
parent
3cceb8ff2b
commit
a59646cbf8
|
@ -67,6 +67,9 @@ hashmap_t *
|
||||||
hashmap_create(hashmap_parameters_t *params)
|
hashmap_create(hashmap_parameters_t *params)
|
||||||
{
|
{
|
||||||
hashmap_t *ret = malloc(sizeof(hashmap_t));
|
hashmap_t *ret = malloc(sizeof(hashmap_t));
|
||||||
|
if (ret == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ret->params = params;
|
ret->params = params;
|
||||||
ret->bucket_count = DEFAULT_HASHMAP_BUCKETS;
|
ret->bucket_count = DEFAULT_HASHMAP_BUCKETS;
|
||||||
|
|
Loading…
Reference in New Issue