Skip to content

Commit 9fdf8af

Browse files
authored
[NFC] Add assert to emmalloc test (#21831)
The test checked alignment of the output of aligned_alloc, but that method returns 0 on errors and 0 is fully aligned, so in theory the test could have missed a problem.
1 parent d9c87f2 commit 9fdf8af

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/other/test_emmalloc_high_align.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ int main() {
1616
// MB). This is similar to what mimalloc does in practice.
1717
void* before = sbrk(0);
1818
void* p = aligned_alloc(ALIGN, SIZE);
19+
// aligned_alloc returns NULL on error; validate we actually allocated.
20+
assert(p);
1921
void* after = sbrk(0);
2022
emscripten_console_logf("before: %p after: %p p: %p\n", before, after, p);
2123

0 commit comments

Comments
 (0)