Fixes
Fabio Cevasco h3rald@h3rald.com
Fri, 27 Dec 2024 22:55:50 +0100
2 files changed,
6 insertions(+),
5 deletions(-)
M
src/registry.c
→
src/registry.c
@@ -70,7 +70,7 @@
ctx->registry->entries[ctx->registry->size] = malloc(sizeof(hex_registry_entry_t)); if (ctx->registry->entries[ctx->registry->size] == NULL) { - hex_error(ctx, "Error: Memory allocation failed for registry entry"); + hex_error(ctx, "[set symbol] Memory allocation failed for registry entry"); return 1; } ctx->registry->entries[ctx->registry->size]->key = strdup(key);@@ -85,7 +85,7 @@ {
hex_item_t *func_item = malloc(sizeof(hex_item_t)); if (func_item == NULL) { - hex_error(ctx, "Error: Memory allocation failed for native symbol '%s'", name); + hex_error(ctx, "[set native symbol] Memory allocation failed for native symbol '%s'", name); return; } func_item->type = HEX_TYPE_NATIVE_SYMBOL;
M
src/stack.c
→
src/stack.c
@@ -342,14 +342,15 @@ copy->token->value = strdup(item->token->value);
if (copy->token->value == NULL) { hex_error(ctx, "[copy item] Failed to allocate memory for token value"); - free(copy->token); - free(copy); + hex_free_token(copy->token); + hex_free_item(copy); return NULL; } break; default: - free(copy); + hex_error(ctx, "[copy item] Failed to copy %s item", hex_type(item->type)); + hex_free_item(copy); return NULL; }