diff options
author | David Robillard <d@drobilla.net> | 2011-01-31 05:23:36 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-01-31 05:23:36 +0000 |
commit | d81b0c688ddb864fe6ebfee818dc1af76c7bc97b (patch) | |
tree | 009d3ac998a34eb63cb5de5632a84d402276a713 /src | |
parent | d5ad97feaff9bcb767d579c71451440a71b1464a (diff) | |
download | lilv-d81b0c688ddb864fe6ebfee818dc1af76c7bc97b.tar.gz lilv-d81b0c688ddb864fe6ebfee818dc1af76c7bc97b.tar.bz2 lilv-d81b0c688ddb864fe6ebfee818dc1af76c7bc97b.zip |
Fix memory leaks.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2887 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/plugin.c | 27 | ||||
-rw-r--r-- | src/port.c | 9 | ||||
-rw-r--r-- | src/world.c | 1 |
3 files changed, 24 insertions, 13 deletions
diff --git a/src/plugin.c b/src/plugin.c index bb18cb8..5ca27e4 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -118,6 +118,7 @@ slv2_plugin_query_node(SLV2Plugin p, librdf_node* subject, librdf_node* predicat p, subject, predicate, NULL); if (slv2_matches_end(results)) { + END_MATCH(results); return NULL; } @@ -137,10 +138,7 @@ slv2_plugin_query_node(SLV2Plugin p, librdf_node* subject, librdf_node* predicat SLV2Value slv2_plugin_get_unique(SLV2Plugin p, librdf_node* subject, librdf_node* predicate) { - SLV2Values values = slv2_plugin_query_node( - p, - librdf_new_node_from_node(subject), - librdf_new_node_from_node(predicate)); + SLV2Values values = slv2_plugin_query_node(p, subject, predicate); if (!values || slv2_values_size(values) != 1) { SLV2_ERRORF("Port does not have exactly one `%s' property\n", librdf_uri_as_string(librdf_node_get_uri(predicate))); @@ -477,6 +475,7 @@ slv2_plugin_get_value_by_qname(SLV2Plugin p, } SLV2Value pred_value = slv2_value_new_uri(p->world, pred_uri); SLV2Values ret = slv2_plugin_get_value(p, pred_value); + slv2_value_free(pred_value); free(pred_uri); return ret; @@ -503,7 +502,6 @@ slv2_plugin_get_value_by_qname_i18n(SLV2Plugin p, librdf_free_node(pred_node); free(pred_uri); - return slv2_values_from_stream_i18n(p, results); } @@ -527,10 +525,9 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p, : librdf_new_node_from_blank_identifier( p->world->world, (const uint8_t*)slv2_value_as_blank(subject)); - return slv2_plugin_query_node( - p, - subject_node, - librdf_new_node_from_node(predicate->val.uri_val)); + return slv2_plugin_query_node(p, + subject_node, + predicate->val.uri_val); } @@ -562,6 +559,10 @@ slv2_plugin_get_port_ranges_float(SLV2Plugin p, if (def && def_values) def_values[i] = slv2_value_as_float(def); + + slv2_value_free(def); + slv2_value_free(min); + slv2_value_free(max); } } @@ -618,12 +619,12 @@ slv2_plugin_has_latency(SLV2Plugin p) port, p->world->lv2_portproperty_node, p->world->lv2_reportslatency_node); - if (!slv2_matches_end(reports_latency)) { + const bool end = slv2_matches_end(reports_latency); + librdf_free_stream(reports_latency); + if (!end) { ret = true; break; } - - librdf_free_stream(reports_latency); } END_MATCH(ports); @@ -654,8 +655,10 @@ slv2_plugin_get_latency_port_index(SLV2Plugin p) ret = slv2_value_as_int(index); slv2_value_free(index); + END_MATCH(reports_latency); break; } + END_MATCH(reports_latency); } END_MATCH(ports); @@ -81,7 +81,11 @@ slv2_port_get_node(SLV2Plugin p, librdf_new_node_from_node(node), librdf_new_node_from_node(p->world->lv2_symbol_node)); - if (slv2_value_equals(symbol, slv2_port_get_symbol(p, port))) { + const bool matches = slv2_value_equals(symbol, + slv2_port_get_symbol(p, port)); + + slv2_value_free(symbol); + if (matches) { ret = librdf_new_node_from_node(node); break; } @@ -136,6 +140,7 @@ static SLV2Values slv2_values_from_stream_objects(SLV2Plugin p, SLV2Matches stream) { if (slv2_matches_end(stream)) { + END_MATCH(stream); return NULL; } @@ -170,6 +175,7 @@ slv2_port_get_value_by_qname(SLV2Plugin p, librdf_new_node_from_uri_string(p->world->world, (const uint8_t*)pred_uri), NULL); + free(pred_uri); return slv2_values_from_stream_objects(p, results); } @@ -227,6 +233,7 @@ slv2_port_get_value_by_qname_i18n(SLV2Plugin p, librdf_new_node_from_uri_string(p->world->world, (const uint8_t*)pred_uri), NULL); + free(pred_uri); return slv2_values_from_stream_i18n(p, results); } diff --git a/src/world.c b/src/world.c index 28868db..10de772 100644 --- a/src/world.c +++ b/src/world.c @@ -535,6 +535,7 @@ slv2_world_load_plugin_classes(SLV2World world) NULL); if (slv2_matches_end(parents)) { + END_MATCH(parents); continue; } |