From 81e10aa64b04641a670313bb8295762c63ef9245 Mon Sep 17 00:00:00 2001 From: Eric-Paul Ickhorn Date: Thu, 12 Sep 2024 23:25:00 +0200 Subject: [PATCH] Fix a bug in the UUID assigner In the UUID assigner, malloc() was used somewhere where it would have been correct to use realloc(). --- modules/utility/src-c/uuid/uuid.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/utility/src-c/uuid/uuid.c b/modules/utility/src-c/uuid/uuid.c index 2a88a0c..5b019d9 100644 --- a/modules/utility/src-c/uuid/uuid.c +++ b/modules/utility/src-c/uuid/uuid.c @@ -65,7 +65,11 @@ vx_uuid_block_s * vx_allocate_new_id_block(vx_uuid_table_s *table) if(table->num_blocks >= table->block_capacity) { table->block_capacity *= 2; - table->blocks = malloc(table->block_capacity * sizeof(vx_uuid_block_s *)); + if( ! table->block_capacity) + { + table->block_capacity = 32; + } + table->blocks = realloc(table->blocks, table->block_capacity * sizeof(vx_uuid_block_s *)); } table->blocks[table->num_blocks] = malloc(sizeof(vx_uuid_block_s)); block = table->blocks[table->num_blocks];