diff options
author | David Robillard <d@drobilla.net> | 2011-04-27 21:23:25 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-27 21:23:25 +0000 |
commit | 03e318d5d80b0cfda96efc58e270693eeabe9a79 (patch) | |
tree | a8c139d374fb09e951b5373bde71eb53b9d4309e /src/plugin.c | |
parent | 3c1b7c2b6633cc1afee350f12d0bd7a7b3eeafa5 (diff) | |
download | lilv-03e318d5d80b0cfda96efc58e270693eeabe9a79.tar.gz lilv-03e318d5d80b0cfda96efc58e270693eeabe9a79.tar.bz2 lilv-03e318d5d80b0cfda96efc58e270693eeabe9a79.zip |
Fix memory leaks.
Don't modify model while reading it.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@3199 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/plugin.c')
-rw-r--r-- | src/plugin.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/plugin.c b/src/plugin.c index 02fa051..7b22707 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -352,7 +352,7 @@ slv2_plugin_get_class(SLV2Plugin p) p->world->rdf_a_node, NULL); FOREACH_MATCH(results) { - SLV2Node class_node = slv2_node_copy(slv2_match_object(results)); + SLV2Node class_node = slv2_match_object(results); if (sord_node_get_type(class_node) != SORD_URI) { continue; } @@ -363,8 +363,6 @@ slv2_plugin_get_class(SLV2Plugin p) SLV2PluginClass plugin_class = slv2_plugin_classes_get_by_uri( p->world->plugin_classes, class); - slv2_node_free(p->world, class_node); - if (plugin_class) { p->plugin_class = plugin_class; slv2_value_free(class); @@ -480,14 +478,12 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p, : sord_new_blank(p->world->world, (const uint8_t*)slv2_value_as_blank(subject)); - if (!subject_node) { - fprintf(stderr, "No such subject\n"); - return NULL; - } + SLV2Values ret = slv2_plugin_query_node(p, + subject_node, + predicate->val.uri_val); - return slv2_plugin_query_node(p, - subject_node, - predicate->val.uri_val); + slv2_node_free(p->world, subject_node); + return ret; } SLV2_API @@ -717,7 +713,7 @@ slv2_plugin_get_author(SLV2Plugin p) return NULL; } - SLV2Node author = slv2_node_copy(slv2_match_object(maintainers)); + SLV2Node author = slv2_match_object(maintainers); slv2_match_end(maintainers); return author; |