summaryrefslogtreecommitdiffstats
path: root/src/plugin.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-07-12 19:46:57 +0000
committerDavid Robillard <d@drobilla.net>2014-07-12 19:46:57 +0000
commitdf38c9eddd81db74174647fd5cca89f7a6de1257 (patch)
tree924f0181b42b80114bcddad9a4e46db8b4637f26 /src/plugin.c
parent19681c50a2da2e368122ed33bf9fda0ae81f3f76 (diff)
downloadlilv-df38c9eddd81db74174647fd5cca89f7a6de1257.tar.gz
lilv-df38c9eddd81db74174647fd5cca89f7a6de1257.tar.bz2
lilv-df38c9eddd81db74174647fd5cca89f7a6de1257.zip
Fix issues with lilv_plugin_get_author_name and friends (thanks Filipe Coelho) (fix #976).
Improve test coverage. Fix several minor memory leaks. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5406 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/plugin.c')
-rw-r--r--src/plugin.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/plugin.c b/src/plugin.c
index cc1bdba..2f9e5b8 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -161,8 +161,10 @@ lilv_plugin_load(LilvPlugin* p)
sord_add(p->world->model, quad);
}
+ sord_iter_free(statements);
lilv_node_free(prototype);
}
+ sord_iter_free(prototypes);
// Parse all the plugin's data files into RDF model
LILV_FOREACH(nodes, i, p->data_uris) {
@@ -833,6 +835,7 @@ lilv_plugin_get_project(const LilvPlugin* p)
sord_node_free(p->world->world, lv2_project);
if (sord_iter_end(projects)) {
+ sord_iter_free(projects);
return NULL;
}
@@ -856,11 +859,12 @@ lilv_plugin_get_author(const LilvPlugin* p)
doap_maintainer,
NULL);
- sord_node_free(p->world->world, doap_maintainer);
-
if (sord_iter_end(maintainers)) {
+ sord_iter_free(maintainers);
+
LilvNode* project = lilv_plugin_get_project(p);
if (!project) {
+ sord_node_free(p->world->world, doap_maintainer);
return NULL;
}
@@ -869,9 +873,14 @@ lilv_plugin_get_author(const LilvPlugin* p)
project->node,
doap_maintainer,
NULL);
+
+ lilv_node_free(project);
}
+ sord_node_free(p->world->world, doap_maintainer);
+
if (sord_iter_end(maintainers)) {
+ sord_iter_free(maintainers);
return NULL;
}
@@ -887,9 +896,11 @@ lilv_plugin_get_author_name(const LilvPlugin* plugin)
{
const SordNode* author = lilv_plugin_get_author(plugin);
if (author) {
- return lilv_plugin_get_one(
- plugin, author, sord_new_uri(
- plugin->world->world, NS_FOAF "name"));
+ SordWorld* sworld = plugin->world->world;
+ SordNode* foaf_name = sord_new_uri(sworld, NS_FOAF "name");
+ LilvNode* ret = lilv_plugin_get_one(plugin, author, foaf_name);
+ sord_node_free(sworld, foaf_name);
+ return ret;
}
return NULL;
}
@@ -900,9 +911,11 @@ lilv_plugin_get_author_email(const LilvPlugin* plugin)
{
const SordNode* author = lilv_plugin_get_author(plugin);
if (author) {
- return lilv_plugin_get_one(
- plugin, author, sord_new_uri(
- plugin->world->world, NS_FOAF "mbox"));
+ SordWorld* sworld = plugin->world->world;
+ SordNode* foaf_mbox = sord_new_uri(sworld, NS_FOAF "mbox");
+ LilvNode* ret = lilv_plugin_get_one(plugin, author, foaf_mbox);
+ sord_node_free(sworld, foaf_mbox);
+ return ret;
}
return NULL;
}
@@ -913,9 +926,11 @@ lilv_plugin_get_author_homepage(const LilvPlugin* plugin)
{
const SordNode* author = lilv_plugin_get_author(plugin);
if (author) {
- return lilv_plugin_get_one(
- plugin, author, sord_new_uri(
- plugin->world->world, NS_FOAF "homepage"));
+ SordWorld* sworld = plugin->world->world;
+ SordNode* foaf_homepage = sord_new_uri(sworld, NS_FOAF "homepage");
+ LilvNode* ret = lilv_plugin_get_one(plugin, author, foaf_homepage);
+ sord_node_free(sworld, foaf_homepage);
+ return ret;
}
return NULL;
}