aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-30 20:11:58 +0100
committerDavid Robillard <d@drobilla.net>2019-03-30 20:23:43 +0100
commita5486dbf5e1ae2fe0f2a8d8cc248a351794b97a1 (patch)
tree0f1f9211d4c9282a09c2e23a50a56e8152d06c55
parentc966234c662ae00d85a3ee53964079af2edcbfaf (diff)
downloadlv2-a5486dbf5e1ae2fe0f2a8d8cc248a351794b97a1.tar.xz
Clean up memory after unit tests
-rw-r--r--lv2/atom/atom-test-utils.c10
-rw-r--r--lv2/atom/atom-test.c2
-rw-r--r--lv2/atom/forge-overflow-test.c6
3 files changed, 17 insertions, 1 deletions
diff --git a/lv2/atom/atom-test-utils.c b/lv2/atom/atom-test-utils.c
index 889c091..057dada 100644
--- a/lv2/atom/atom-test-utils.c
+++ b/lv2/atom/atom-test-utils.c
@@ -49,6 +49,16 @@ urid_map(LV2_URID_Map_Handle handle, const char* uri)
return n_uris;
}
+static void
+free_urid_map(void)
+{
+ for (uint32_t i = 0; i < n_uris; ++i) {
+ free(uris[i]);
+ }
+
+ free(uris);
+}
+
static int
test_fail(const char* fmt, ...)
{
diff --git a/lv2/atom/atom-test.c b/lv2/atom/atom-test.c
index 3b902d8..5189d9d 100644
--- a/lv2/atom/atom-test.c
+++ b/lv2/atom/atom-test.c
@@ -357,5 +357,7 @@ main(void)
0);
}
+ free_urid_map();
+
return 0;
}
diff --git a/lv2/atom/forge-overflow-test.c b/lv2/atom/forge-overflow-test.c
index b9beacc..353ad79 100644
--- a/lv2/atom/forge-overflow-test.c
+++ b/lv2/atom/forge-overflow-test.c
@@ -106,5 +106,9 @@ test_literal_overflow(void)
int
main(void)
{
- return test_string_overflow() || test_literal_overflow();
+ const int ret = test_string_overflow() || test_literal_overflow();
+
+ free_urid_map();
+
+ return ret;
}