summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sord.c13
-rw-r--r--src/sordi.c2
2 files changed, 14 insertions, 1 deletions
diff --git a/src/sord.c b/src/sord.c
index fa9c074..17f90e5 100644
--- a/src/sord.c
+++ b/src/sord.c
@@ -169,9 +169,22 @@ sord_world_new(void)
return world;
}
+static void
+free_hash_entry(void* key, void* value, void* user_data)
+{
+ SordNode* node = (SordNode*)value;
+ if (node->node.type == SERD_LITERAL) {
+ sord_node_free((SordWorld*)user_data, node->datatype);
+ }
+ g_free((uint8_t*)node->node.buf);
+ free(node);
+}
+
void
sord_world_free(SordWorld* world)
{
+ g_hash_table_foreach(world->literals, free_hash_entry, world);
+ g_hash_table_foreach(world->names, free_hash_entry, world);
g_hash_table_unref(world->names);
g_hash_table_unref(world->langs);
g_hash_table_unref(world->literals);
diff --git a/src/sordi.c b/src/sordi.c
index 7681878..f2f3e59 100644
--- a/src/sordi.c
+++ b/src/sordi.c
@@ -212,7 +212,7 @@ main(int argc, char** argv)
writer);
// Write statements
- sord_write_writer(sord, writer, NULL);
+ sord_write(sord, writer, NULL);
serd_writer_finish(writer);
serd_writer_free(writer);