diff options
author | David Robillard <d@drobilla.net> | 2019-10-19 21:01:44 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:59 +0100 |
commit | b187e0541e9ac422168fc436429e79fbe70de7a7 (patch) | |
tree | 6dafbbf6bf4d27b8676c8df1c8be37e0092143bb /src | |
parent | 3c5ccf16e7dc0eef903c3c49958559cb4a3a370b (diff) | |
download | serd-b187e0541e9ac422168fc436429e79fbe70de7a7.tar.gz serd-b187e0541e9ac422168fc436429e79fbe70de7a7.tar.bz2 serd-b187e0541e9ac422168fc436429e79fbe70de7a7.zip |
Fix memory leak in writer when caller doesn't clean up the stack
Diffstat (limited to 'src')
-rw-r--r-- | src/writer.c | 5 |
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; |