fixes
Fabio Cevasco h3rald@h3rald.com
Sat, 28 Dec 2024 06:21:27 +0100
1 files changed,
59 insertions(+),
23 deletions(-)
jump to
M
src/symbols.c
→
src/symbols.c
@@ -1198,14 +1198,20 @@ }
if ((a->type == HEX_TYPE_INTEGER && b->type == HEX_TYPE_INTEGER) || (a->type == HEX_TYPE_STRING && b->type == HEX_TYPE_STRING) || (a->type == HEX_TYPE_QUOTATION && b->type == HEX_TYPE_QUOTATION)) { int result = hex_push_integer(ctx, hex_equal(a, b)); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; } // Different types => false int result = hex_push_integer(ctx, 0); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; }@@ -1229,14 +1235,20 @@ }
if ((a->type == HEX_TYPE_INTEGER && b->type == HEX_TYPE_INTEGER) || (a->type == HEX_TYPE_STRING && b->type == HEX_TYPE_STRING) || (a->type == HEX_TYPE_QUOTATION && b->type == HEX_TYPE_QUOTATION)) { int result = hex_push_integer(ctx, !hex_equal(a, b)); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; } // Different types => true int result = hex_push_integer(ctx, 1); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; }@@ -1260,8 +1272,11 @@ }
hex_item_t *pa = a; hex_item_t *pb = b; int result = hex_push_integer(ctx, hex_greater(ctx, pa, pb, ">")); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; }@@ -1285,8 +1300,11 @@ }
hex_item_t *pa = a; hex_item_t *pb = b; int result = hex_push_integer(ctx, hex_greater(ctx, pb, pa, "<")); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; }@@ -1310,8 +1328,11 @@ }
hex_item_t *pa = a; hex_item_t *pb = b; int result = hex_push_integer(ctx, hex_greater(ctx, pa, pb, ">") || hex_equal(a, b)); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; }@@ -1335,8 +1356,11 @@ }
hex_item_t *pa = a; hex_item_t *pb = b; int result = hex_push_integer(ctx, hex_greater(ctx, pb, pa, "<") || hex_equal(a, b)); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; }@@ -1362,8 +1386,11 @@ }
if (a->type == HEX_TYPE_INTEGER && b->type == HEX_TYPE_INTEGER) { int result = hex_push_integer(ctx, a->data.int_value && b->data.int_value); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; } hex_error(ctx, "[symbol and] Two integers required");@@ -1392,8 +1419,11 @@ }
if (a->type == HEX_TYPE_INTEGER && b->type == HEX_TYPE_INTEGER) { int result = hex_push_integer(ctx, a->data.int_value || b->data.int_value); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; } hex_error(ctx, "[symbol or] Two integers required");@@ -1419,7 +1449,10 @@ }
if (a->type == HEX_TYPE_INTEGER) { int result = hex_push_integer(ctx, !a->data.int_value); - HEX_FREE(ctx, a); + if (result != 0) + { + HEX_FREE(ctx, a); + } return result; } hex_error(ctx, "[symbol not] Integer required");@@ -1460,8 +1493,11 @@ }
if (a->type == HEX_TYPE_INTEGER && b->type == HEX_TYPE_INTEGER) { int result = hex_push_integer(ctx, a->data.int_value ^ b->data.int_value); - HEX_FREE(ctx, a); - HEX_FREE(ctx, b); + if (result != 0) + { + HEX_FREE(ctx, a); + HEX_FREE(ctx, b); + } return result; } hex_error(ctx, "[symbol xor] Two integers required");