summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-02-18 17:50:43 +0000
committerDavid Robillard <d@drobilla.net>2013-02-18 17:50:43 +0000
commitbcdcb433808243999b4e15aa04b8be51135f89de (patch)
treed98b95d460ec628ddcc254fa5134bfce1e73c46a /src
parent36c22be51af07fc96a9168684949b82b8f6e325c (diff)
downloadlilv-bcdcb433808243999b4e15aa04b8be51135f89de.tar.gz
lilv-bcdcb433808243999b4e15aa04b8be51135f89de.tar.bz2
lilv-bcdcb433808243999b4e15aa04b8be51135f89de.zip
Fix SordNode leaks.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5056 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/state.c9
-rw-r--r--src/world.c15
2 files changed, 12 insertions, 12 deletions
diff --git a/src/state.c b/src/state.c
index 3176fd1..77f6365 100644
--- a/src/state.c
+++ b/src/state.c
@@ -659,14 +659,13 @@ lilv_state_new_from_string(LilvWorld* world,
set_prefixes(env);
serd_reader_read_string(reader, USTR(str));
- const SordNode* p = sord_new_uri(world->world, USTR(LILV_NS_RDF "type"));
- const SordNode* o = sord_new_uri(world->world, USTR(LV2_PRESETS__Preset));
- SordIter* const i = sord_search(model, NULL, p, o, NULL);
- const SordNode* s = sord_iter_get_node(i, SORD_SUBJECT);
+ SordNode* o = sord_new_uri(world->world, USTR(LV2_PRESETS__Preset));
+ SordNode* s = sord_get(model, NULL, world->uris.rdf_a, o, NULL);
LilvState* state = new_state_from_model(world, map, model, s, NULL);
- sord_iter_free(i);
+ sord_node_free(world->world, s);
+ sord_node_free(world->world, o);
serd_reader_free(reader);
sord_free(model);
serd_env_free(env);
diff --git a/src/world.c b/src/world.c
index 147690b..4262723 100644
--- a/src/world.c
+++ b/src/world.c
@@ -208,13 +208,14 @@ lilv_world_get(LilvWorld* world,
const LilvNode* predicate,
const LilvNode* object)
{
- return lilv_node_new_from_node(
- world,
- sord_get(world->model,
- subject ? subject->node : NULL,
- predicate ? predicate->node : NULL,
- object ? object->node : NULL,
- NULL));
+ SordNode* snode = sord_get(world->model,
+ subject ? subject->node : NULL,
+ predicate ? predicate->node : NULL,
+ object ? object->node : NULL,
+ NULL);
+ LilvNode* lnode = lilv_node_new_from_node(world, snode);
+ sord_node_free(world->world, snode);
+ return lnode;
}
SordIter*