From 4e88af1babd6555c389b1e14316c29b78146f8f0 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 14 May 2024 20:52:41 +0200 Subject: Properly deallocate memory --- test/_brk-test.h | 10 +++++++--- 1 file 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; } -- cgit v1.2.3