all repos — hex @ 514b9c73d05fede36c58dad4c8af8253efd8613c

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Cleanup not working.
h3rald h3rald@h3rald.com
Wed, 01 Jan 2025 21:28:33 +0000
commit

514b9c73d05fede36c58dad4c8af8253efd8613c

parent

f59168eba7b2126276ea99b670cd5e51dd5f352f

1 files changed, 4 insertions(+), 2 deletions(-)

jump to
M src/registry.csrc/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;