summaryrefslogtreecommitdiff
path: root/libyasm
diff options
context:
space:
mode:
authorDuncan Ogilvie <mr.exodia.tpodt@gmail.com>2023-05-13 06:19:37 +0200
committerGitHub <noreply@github.com>2023-05-12 21:19:37 -0700
commit8b6c7b237c6c36614ddc6942b9568d1c214d25ef (patch)
tree6dc2a9f04eab015f19a3d42f1ae4b4e80d16c64f /libyasm
parente9badc5a77813003baae4e73d4bfd0298069459f (diff)
downloadyasm-8b6c7b237c6c36614ddc6942b9568d1c214d25ef.tar.gz
Fix allocator mismatch (#107)
Diffstat (limited to 'libyasm')
-rw-r--r--libyasm/bitvect.c4
-rw-r--r--libyasm/file.c4
-rw-r--r--libyasm/tests/bitvect_test.c2
-rw-r--r--libyasm/tests/floatnum_test.c6
4 files changed, 8 insertions, 8 deletions
diff --git a/libyasm/bitvect.c b/libyasm/bitvect.c
index dfb08252..b6570ea3 100644
--- a/libyasm/bitvect.c
+++ b/libyasm/bitvect.c
@@ -457,7 +457,7 @@ void BitVector_Destroy_List(listptr list, N_int count) /* free list */
{
BitVector_Destroy(*slot++);
}
- free((voidptr) list);
+ yasm_xfree((voidptr) list);
}
}
@@ -496,7 +496,7 @@ listptr BitVector_Create_List(N_int bits, boolean clear, N_int count)
if (count > 0)
{
- list = (listptr) malloc(sizeof(wordptr) * count);
+ list = (listptr) yasm_xmalloc(sizeof(wordptr) * count);
if (list != NULL)
{
slot = list;
diff --git a/libyasm/file.c b/libyasm/file.c
index fc7dab6c..ea9f603b 100644
--- a/libyasm/file.c
+++ b/libyasm/file.c
@@ -473,7 +473,7 @@ yasm__createpath_common(const char *path, int win)
size_t len, lth;
lth = len = strlen(path);
- ts = tp = (char *) malloc(len + 1);
+ ts = tp = (char *) yasm_xmalloc(len + 1);
pe = pp + len;
while (pe > pp) {
if ((win && *pe == '\\') || *pe == '/')
@@ -523,7 +523,7 @@ yasm__createpath_common(const char *path, int win)
}
*tp++ = *pp++;
}
- free(ts);
+ yasm_xfree(ts);
return lth;
}
diff --git a/libyasm/tests/bitvect_test.c b/libyasm/tests/bitvect_test.c
index f7b34130..367b12bc 100644
--- a/libyasm/tests/bitvect_test.c
+++ b/libyasm/tests/bitvect_test.c
@@ -109,7 +109,7 @@ num_check(Val *val)
strcat(result_msg, ": ");
strcat(result_msg, (char *)ascii);
}
- free(result);
+ yasm_xfree(result);
return ret;
}
diff --git a/libyasm/tests/floatnum_test.c b/libyasm/tests/floatnum_test.c
index 30b8d6ce..2447e90b 100644
--- a/libyasm/tests/floatnum_test.c
+++ b/libyasm/tests/floatnum_test.c
@@ -177,7 +177,7 @@ new_check_flt(Init_Entry *val)
for (i=1;i<MANT_BYTES;i++) /* don't compare first byte */
if (mantissa[i] != val->mantissa[i])
result = 1;
- free(mantissa);
+ yasm_xfree(mantissa);
if (result) {
strcat(result_msg, "mantissa");
return 1;
@@ -231,7 +231,7 @@ test_new_normalized_edgecase(void)
static void
get_family_setup(void)
{
- flt = malloc(sizeof(yasm_floatnum));
+ flt = yasm_xmalloc(sizeof(yasm_floatnum));
flt->mantissa = BitVector_Create(MANT_BITS, TRUE);
}
@@ -239,7 +239,7 @@ static void
get_family_teardown(void)
{
BitVector_Destroy(flt->mantissa);
- free(flt);
+ yasm_xfree(flt);
}
static void