summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-12-29 10:19:37 -0500
committerDavid Robillard <d@drobilla.net>2017-12-29 10:44:36 -0500
commit3c427ddbbb38eb271dcd1b8d23cbe07c8a8be025 (patch)
treed338d5e01bc17a6d36f229846a8663eeb01fe3bb
parent8c13a50d14f01935919bfb774b02d0cbfdd42fd7 (diff)
downloadlilv-3c427ddbbb38eb271dcd1b8d23cbe07c8a8be025.tar.gz
lilv-3c427ddbbb38eb271dcd1b8d23cbe07c8a8be025.tar.bz2
lilv-3c427ddbbb38eb271dcd1b8d23cbe07c8a8be025.zip
Fix potential memory leaks
-rw-r--r--src/world.c5
-rw-r--r--utils/lv2apply.c2
-rw-r--r--utils/lv2bench.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/src/world.c b/src/world.c
index fb3f7e0..1d8fec8 100644
--- a/src/world.c
+++ b/src/world.c
@@ -54,7 +54,7 @@ lilv_world_new(void)
#define NS_DYNMAN "http://lv2plug.in/ns/ext/dynmanifest#"
#define NS_OWL "http://www.w3.org/2002/07/owl#"
-#define NEW_URI(uri) sord_new_uri(world->world, (const uint8_t*)uri)
+#define NEW_URI(uri) sord_new_uri(world->world, (const uint8_t*)(uri))
world->uris.dc_replaces = NEW_URI(NS_DCTERMS "replaces");
world->uris.dman_DynManifest = NEW_URI(NS_DYNMAN "DynManifest");
@@ -598,6 +598,9 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
const SordNode* plug = sord_iter_get_node(p, SORD_SUBJECT);
lilv_world_add_plugin(world, plug, manifest, desc, bundle_node);
}
+ if (desc->refs == 0) {
+ free(desc);
+ }
sord_iter_free(p);
sord_free(plugins);
lilv_free(lib_path);
diff --git a/utils/lv2apply.c b/utils/lv2apply.c
index 7fc07b2..7f45733 100644
--- a/utils/lv2apply.c
+++ b/utils/lv2apply.c
@@ -230,9 +230,11 @@ main(int argc, char** argv)
const char* plugin_uri = NULL;
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "--version")) {
+ free(self.params);
print_version();
return 0;
} else if (!strcmp(argv[i], "--help")) {
+ free(self.params);
return print_usage(0);
} else if (!strcmp(argv[i], "-i")) {
self.in_path = argv[++i];
diff --git a/utils/lv2bench.c b/utils/lv2bench.c
index 3fd97da..e3eb57f 100644
--- a/utils/lv2bench.c
+++ b/utils/lv2bench.c
@@ -144,6 +144,7 @@ bench(const LilvPlugin* p, uint32_t sample_count, uint32_t block_size)
fprintf(stderr, "<%s> port %d neither input nor output, skipping\n",
uri, index);
lilv_instance_free(instance);
+ free(seq_out);
free(buf);
free(controls);
uri_table_destroy(&uri_table);
@@ -159,6 +160,7 @@ bench(const LilvPlugin* p, uint32_t sample_count, uint32_t block_size)
fprintf(stderr, "<%s> port %d has unknown type, skipping\n",
uri, index);
lilv_instance_free(instance);
+ free(seq_out);
free(buf);
free(controls);
uri_table_destroy(&uri_table);