From a59646cbf84d1bb463c4b9526dacdf40075851c2 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 24 Feb 2020 08:23:45 +0000 Subject: Hashmap: Check for failure of first malloc. --- utils/hashmap.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'utils') diff --git a/utils/hashmap.c b/utils/hashmap.c index 814dc55b5..9cdc5a23a 100644 --- a/utils/hashmap.c +++ b/utils/hashmap.c @@ -67,6 +67,9 @@ hashmap_t * hashmap_create(hashmap_parameters_t *params) { hashmap_t *ret = malloc(sizeof(hashmap_t)); + if (ret == NULL) { + return NULL; + } ret->params = params; ret->bucket_count = DEFAULT_HASHMAP_BUCKETS; -- cgit v1.2.3