diff --git a/src/address-map.h b/src/address-map.h index 4b6b0c47f..57c2a0a04 100644 --- a/src/address-map.h +++ b/src/address-map.h @@ -6,6 +6,7 @@ #include #include "address-hash.h" +#include "gc-assert.h" struct hash_map_entry { uintptr_t k; @@ -28,7 +29,9 @@ static void hash_map_clear(struct hash_map *map) { static void hash_map_init(struct hash_map *map, size_t size) { map->size = size; map->data = malloc(sizeof(struct hash_map_entry) * size); + if (!map->data) GC_CRASH(); map->bits = malloc(size / 8); + if (!map->bits) GC_CRASH(); hash_map_clear(map); } static void hash_map_destroy(struct hash_map *map) { diff --git a/src/address-set.h b/src/address-set.h index 74bc08888..b1c27fa41 100644 --- a/src/address-set.h +++ b/src/address-set.h @@ -6,6 +6,7 @@ #include #include "address-hash.h" +#include "gc-assert.h" struct hash_set { uintptr_t *data; @@ -23,7 +24,9 @@ static void hash_set_clear(struct hash_set *set) { static void hash_set_init(struct hash_set *set, size_t size) { set->size = size; set->data = malloc(sizeof(uintptr_t) * size); + if (!set->data) GC_CRASH(); set->bits = malloc(size / 8); + if (!set->bits) GC_CRASH(); hash_set_clear(set); } static void hash_set_destroy(struct hash_set *set) {