summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-09-26 17:45:35 +0200
committerDavid Robillard <d@drobilla.net>2020-09-26 17:46:10 +0200
commit0202e15d0e96318ea5b4a77dde3f2f305b5e811b (patch)
treebe5d1e8de6d9716f3938c590765abc903baf6e04
parent61b46e7a9d9a96c02fea8265cb319389a1141fab (diff)
downloadlilv-0202e15d0e96318ea5b4a77dde3f2f305b5e811b.tar.gz
lilv-0202e15d0e96318ea5b4a77dde3f2f305b5e811b.tar.bz2
lilv-0202e15d0e96318ea5b4a77dde3f2f305b5e811b.zip
Fix memory leaks in lv2bench
-rw-r--r--NEWS3
-rw-r--r--utils/lv2bench.c5
-rw-r--r--utils/uri_table.h4
3 files changed, 10 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index ab3a96e..5d7ecd0 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,9 @@
lilv (0.24.9) unstable;
+ * Fix memory leaks in lv2bench
* Make lilv_world_get() use translations
- -- David Robillard <d@drobilla.net> Sun, 17 May 2020 18:44:04 +0000
+ -- David Robillard <d@drobilla.net> Sat, 26 Sep 2020 15:44:21 +0000
lilv (0.24.8) stable;
diff --git a/utils/lv2bench.c b/utils/lv2bench.c
index 2c22a3b..dc0fa0b 100644
--- a/utils/lv2bench.c
+++ b/utils/lv2bench.c
@@ -188,6 +188,9 @@ bench(const LilvPlugin* p, uint32_t sample_count, uint32_t block_size)
lilv_instance_deactivate(instance);
lilv_instance_free(instance);
+ free(controls);
+ free(maxes);
+ free(mins);
free(seq_out);
uri_table_destroy(&uri_table);
@@ -198,7 +201,6 @@ bench(const LilvPlugin* p, uint32_t sample_count, uint32_t block_size)
printf("%lf %s\n", elapsed, uri);
free(buf);
- free(controls);
return elapsed;
}
@@ -252,6 +254,7 @@ main(int argc, char** argv)
if (plugin_uri_str) {
LilvNode* uri = lilv_new_uri(world, plugin_uri_str);
bench(lilv_plugins_get_by_uri(plugins, uri), sample_count, block_size);
+ lilv_node_free(uri);
} else {
LILV_FOREACH(plugins, i, plugins) {
bench(lilv_plugins_get(plugins, i), sample_count, block_size);
diff --git a/utils/uri_table.h b/utils/uri_table.h
index 36c3621..3b374bb 100644
--- a/utils/uri_table.h
+++ b/utils/uri_table.h
@@ -41,6 +41,10 @@ uri_table_init(URITable* table)
static void
uri_table_destroy(URITable* table)
{
+ for (size_t i = 0; i < table->n_uris; ++i) {
+ free(table->uris[i]);
+ }
+
free(table->uris);
}