diff options
author | David Robillard <d@drobilla.net> | 2011-03-07 20:12:42 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-03-07 20:12:42 +0000 |
commit | 567b4cc4fec495044e2e03d9f4d157fe65f3022a (patch) | |
tree | 173ae1c7103546d4e0ad693210acae669b852e0c | |
parent | 690ca2d4559a0cb63c41e7175c26a711100f5bc5 (diff) | |
download | lilv-567b4cc4fec495044e2e03d9f4d157fe65f3022a.tar.gz lilv-567b4cc4fec495044e2e03d9f4d157fe65f3022a.tar.bz2 lilv-567b4cc4fec495044e2e03d9f4d157fe65f3022a.zip |
Fix memory leaks.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@3052 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/plugin.c | 12 | ||||
-rw-r--r-- | src/slv2_internal.h | 5 | ||||
-rw-r--r-- | src/value.c | 6 | ||||
-rw-r--r-- | src/world.c | 54 |
4 files changed, 36 insertions, 41 deletions
diff --git a/src/plugin.c b/src/plugin.c index f104225..f2d1837 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -375,7 +375,7 @@ slv2_plugin_get_class(SLV2Plugin p) SLV2PluginClass plugin_class = slv2_plugin_classes_get_by_uri( p->world->plugin_classes, class); - slv2_node_free(class_node); + slv2_node_free(p->world, class_node); if (plugin_class) { p->plugin_class = plugin_class; @@ -726,7 +726,7 @@ slv2_plugin_get_author(SLV2Plugin p) doap_maintainer, NULL); - slv2_node_free(doap_maintainer); + slv2_node_free(p->world, doap_maintainer); if (slv2_matches_end(maintainers)) { return NULL; @@ -815,8 +815,8 @@ slv2_plugin_get_uis(SLV2Plugin p) } slv2_match_end(uis); - slv2_node_free(ui_binary_node); - slv2_node_free(ui_ui_node); + slv2_node_free(p->world, ui_binary_node); + slv2_node_free(p->world, ui_ui_node); if (slv2_uis_size(result) > 0) { return result; @@ -879,8 +879,8 @@ slv2_plugin_get_default_ui(SLV2Plugin p, } slv2_match_end(uis); - slv2_node_free(ui_binary_node); - slv2_node_free(ui_ui_node); + slv2_node_free(p->world, ui_binary_node); + slv2_node_free(p->world, ui_ui_node); return (native) ? native : foreign; #else diff --git a/src/slv2_internal.h b/src/slv2_internal.h index 9f6638c..0752044 100644 --- a/src/slv2_internal.h +++ b/src/slv2_internal.h @@ -302,10 +302,11 @@ struct _SLV2Header* slv2_sequence_get_by_uri(GSequence* seq, SLV2Value uri); static inline SLV2Node slv2_node_copy(SLV2Node node) { - return node; + return sord_node_copy(node); } -static inline void slv2_node_free(SLV2Node node) { +static inline void slv2_node_free(SLV2World world, SLV2Node node) { + sord_node_free(world->world, node); } diff --git a/src/value.c b/src/value.c index b37050d..09a0720 100644 --- a/src/value.c +++ b/src/value.c @@ -219,11 +219,9 @@ void slv2_value_free(SLV2Value val) { if (val) { - if (val->type == SLV2_VALUE_URI) - slv2_node_free(val->val.uri_val); - else + if (val->type != SLV2_VALUE_URI) { free(val->str_val); - + } free(val); } } diff --git a/src/world.c b/src/world.c index 8b5d1cf..3749f1f 100644 --- a/src/world.c +++ b/src/world.c @@ -127,31 +127,30 @@ slv2_world_free(SLV2World world) slv2_plugin_class_free(world->lv2_plugin_class); world->lv2_plugin_class = NULL; - slv2_node_free(world->dyn_manifest_node); - slv2_node_free(world->lv2_specification_node); - slv2_node_free(world->lv2_plugin_node); - slv2_node_free(world->lv2_binary_node); - slv2_node_free(world->lv2_default_node); - slv2_node_free(world->lv2_minimum_node); - slv2_node_free(world->lv2_maximum_node); - slv2_node_free(world->lv2_port_node); - slv2_node_free(world->lv2_portproperty_node); - slv2_node_free(world->lv2_reportslatency_node); - slv2_node_free(world->lv2_index_node); - slv2_node_free(world->lv2_symbol_node); - slv2_node_free(world->rdf_a_node); - slv2_node_free(world->rdf_value_node); - slv2_node_free(world->rdfs_label_node); - slv2_node_free(world->rdfs_seealso_node); - slv2_node_free(world->rdfs_subclassof_node); - slv2_node_free(world->rdfs_class_node); - slv2_node_free(world->slv2_bundleuri_node); - slv2_node_free(world->slv2_dmanifest_node); - slv2_node_free(world->xsd_boolean_node); - slv2_node_free(world->xsd_decimal_node); - slv2_node_free(world->xsd_double_node); - slv2_node_free(world->xsd_integer_node); - + slv2_node_free(world, world->dyn_manifest_node); + slv2_node_free(world, world->lv2_specification_node); + slv2_node_free(world, world->lv2_plugin_node); + slv2_node_free(world, world->lv2_binary_node); + slv2_node_free(world, world->lv2_default_node); + slv2_node_free(world, world->lv2_minimum_node); + slv2_node_free(world, world->lv2_maximum_node); + slv2_node_free(world, world->lv2_port_node); + slv2_node_free(world, world->lv2_portproperty_node); + slv2_node_free(world, world->lv2_reportslatency_node); + slv2_node_free(world, world->lv2_index_node); + slv2_node_free(world, world->lv2_symbol_node); + slv2_node_free(world, world->rdf_a_node); + slv2_node_free(world, world->rdf_value_node); + slv2_node_free(world, world->rdfs_label_node); + slv2_node_free(world, world->rdfs_seealso_node); + slv2_node_free(world, world->rdfs_subclassof_node); + slv2_node_free(world, world->rdfs_class_node); + slv2_node_free(world, world->slv2_bundleuri_node); + slv2_node_free(world, world->slv2_dmanifest_node); + slv2_node_free(world, world->xsd_boolean_node); + slv2_node_free(world, world->xsd_decimal_node); + slv2_node_free(world, world->xsd_double_node); + slv2_node_free(world, world->xsd_integer_node); slv2_value_free(world->doap_name_val); slv2_value_free(world->lv2_name_val); @@ -450,7 +449,7 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri) // Add ?specification rdfs:seeAlso <manifest.ttl> SordQuad see_also_tup = { slv2_node_copy(spec), - world->rdfs_seealso_node, + slv2_node_copy(world->rdfs_seealso_node), sord_new_uri(world->world, manifest_uri.buf), NULL }; @@ -651,9 +650,6 @@ slv2_world_load_plugin_classes(SLV2World world) if (pclass) { slv2_sequence_insert(classes, pclass); } - - slv2_node_free(parent_node); - slv2_node_free(label_node); } slv2_match_end(classes); } |