diff --git a/prism/static_literals.c b/prism/static_literals.c index 64d6ffeec9..713721bb73 100644 --- a/prism/static_literals.c +++ b/prism/static_literals.c @@ -135,7 +135,7 @@ pm_node_hash_insert(pm_node_hash_t *hash, const pm_parser_t *parser, pm_node_t * if (hash->size * 2 >= hash->capacity) { // First, allocate space for the new node list. uint32_t new_capacity = hash->capacity == 0 ? 4 : hash->capacity * 2; - pm_node_t **new_nodes = calloc(new_capacity, sizeof(pm_node_t *)); + pm_node_t **new_nodes = xcalloc(new_capacity, sizeof(pm_node_t *)); if (new_nodes == NULL) return NULL; // It turns out to be more efficient to mask the hash value than to use @@ -155,7 +155,7 @@ pm_node_hash_insert(pm_node_hash_t *hash, const pm_parser_t *parser, pm_node_t * } // Finally, free the old node list and update the hash. - free(hash->nodes); + xfree(hash->nodes); hash->nodes = new_nodes; hash->capacity = new_capacity; } @@ -188,7 +188,7 @@ pm_node_hash_insert(pm_node_hash_t *hash, const pm_parser_t *parser, pm_node_t * */ static void pm_node_hash_free(pm_node_hash_t *hash) { - if (hash->capacity > 0) free(hash->nodes); + if (hash->capacity > 0) xfree(hash->nodes); } /** diff --git a/prism/util/pm_constant_pool.c b/prism/util/pm_constant_pool.c index 5f3b0e92c8..19c372e655 100644 --- a/prism/util/pm_constant_pool.c +++ b/prism/util/pm_constant_pool.c @@ -18,7 +18,7 @@ bool pm_constant_id_list_append(pm_constant_id_list_t *list, pm_constant_id_t id) { if (list->size >= list->capacity) { list->capacity = list->capacity == 0 ? 8 : list->capacity * 2; - list->ids = (pm_constant_id_t *) realloc(list->ids, sizeof(pm_constant_id_t) * list->capacity); + list->ids = (pm_constant_id_t *) xrealloc(list->ids, sizeof(pm_constant_id_t) * list->capacity); if (list->ids == NULL) return false; }