From 03e318d5d80b0cfda96efc58e270693eeabe9a79 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 27 Apr 2011 21:23:25 +0000 Subject: 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 --- src/plugin.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/plugin.c') 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; -- cgit v1.2.1