aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/writer.c b/src/writer.c
index a47252c8..acb63d7d 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -1029,6 +1029,11 @@ serd_writer_finish(SerdWriter* writer)
st = write_sep(writer, writer->context.flags, SEP_GRAPH_END);
}
+ // Free any lingering contexts in case there was an error
+ while (!serd_stack_is_empty(&writer->anon_stack)) {
+ pop_context(writer);
+ }
+
free_context(writer);
writer->indent = 0;
writer->context = WRITE_CONTEXT_NULL;