diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-05-14 20:52:41 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-05-14 20:52:41 +0200 |
commit | 4e88af1babd6555c389b1e14316c29b78146f8f0 (patch) | |
tree | 1f5f21286fdc64251cd4d5d6dbb9022c654bb7dd /test | |
parent | 0cf2b231e34dcf88b4d7abcdb01785b6aba265ce (diff) |
Properly deallocate memory
Diffstat (limited to 'test')
-rw-r--r-- | test/_brk-test.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/_brk-test.h b/test/_brk-test.h index 909f33f..396138b 100644 --- a/test/_brk-test.h +++ b/test/_brk-test.h @@ -54,6 +54,7 @@ main(int, char **argv) bool test(struct u8view sv, int id) { + bool rv = true; size_t total = 0; arena a = mkarena(0); @@ -94,7 +95,8 @@ test(struct u8view sv, int id) if (items_got != items.len) { warn("case %d: expected %zu %s(s) but got %zu: ‘%s’", id, items.len, STR(BRKTYPE_LONG), items_got, sv.p); - return false; + rv = false; + goto out; } /* Assert the individual items are correct */ @@ -104,11 +106,13 @@ test(struct u8view sv, int id) if (!u8eq(it1, ((struct u8view){it2.buf, it2.len}))) { warn("case %d: expected %s ‘%.*s’ but got ‘%.*s’", id, STR(BRKTYPE_LONG), (int)it2.len, it2.buf, SV_PRI_ARGS(it1)); - return false; + rv = false; + goto out; } } +out: arena_free(&a); free(p); - return true; + return rv; } |