From 66a7b635331baaa483ba3cc27aef6c244f9a98df Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 25 Jul 2007 06:07:21 +0000 Subject: Don't call librdf_free_world if world was passed by called using slv2_world_new_using_rdf_world. git-svn-id: http://svn.drobilla.net/lad/slv2@623 a436a847-0d15-0410-975c-d299462d15a1 --- src/world.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/world.c') diff --git a/src/world.c b/src/world.c index d3776e5..26ca852 100644 --- a/src/world.c +++ b/src/world.c @@ -37,6 +37,8 @@ slv2_world_new() world->world = librdf_new_world(); if (!world->world) goto fail; + + world->local_world = true; librdf_world_open(world->world); @@ -87,7 +89,11 @@ slv2_world_new_using_rdf_world(librdf_world* rdf_world) SLV2World world = (SLV2World)malloc(sizeof(struct _SLV2World)); world->world = rdf_world; + if (!world->world) + goto fail; + world->local_world = false; + world->storage = librdf_new_storage(world->world, "hashes", NULL, "hash-type='memory'"); if (!world->storage) @@ -155,7 +161,9 @@ slv2_world_free(SLV2World world) librdf_free_storage(world->storage); world->storage = NULL; - librdf_free_world(world->world); + if (world->local_world) + librdf_free_world(world->world); + world->world = NULL; if (world->rdf_unlock) -- cgit v1.2.1