Cleanup not working.
h3rald h3rald@h3rald.com
Wed, 01 Jan 2025 21:28:33 +0000
1 files changed,
4 insertions(+),
2 deletions(-)
jump to
M
src/registry.c
→
src/registry.c
@@ -157,7 +157,8 @@ if (strcmp(entry->key, key) == 0)
{ // Key already exists, update its value hex_free_item(ctx, entry->value); // Free old value - entry->value = value; + entry->value = malloc(sizeof(hex_item_t)); + entry->value = hex_copy_item(ctx, value); return 0; } entry = entry->next;@@ -171,7 +172,8 @@ return 1; // Memory allocation failed
} new_entry->key = strdup(key); - new_entry->value = value; + new_entry->value = malloc(sizeof(hex_item_t)); + new_entry->value = hex_copy_item(ctx, value); new_entry->next = registry->buckets[bucket_index]; registry->buckets[bucket_index] = new_entry;