authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-28 03:26:37 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-28 03:26:37 -07:00
log0dacc15ec5f7780721bc6668dc81578706ad0d8c
treec076ed6f94f5dfe39ee6e803d6681964bba60c1e
parentd55b67f873b850892dc08f2f5346f95cc3d3fedd

util/yaml- defer parser destroy so that it runs even if try fails


1 files changed, 1 insertions(+), 2 deletions(-)

src/util/yaml.zig+1-2
......@@ -148,6 +148,7 @@ pub const TokenList = []const Token;
148148pub fn parse(alloc: *std.mem.Allocator, input: string) !Document {
149149 var parser: c.yaml_parser_t = undefined;
150150 _ = c.yaml_parser_initialize(&parser);
151 defer c.yaml_parser_delete(&parser);
151152
152153 const lines = try u.split(input, "\n");
153154
......@@ -170,8 +171,6 @@ pub fn parse(alloc: *std.mem.Allocator, input: string) !Document {
170171 }
171172 }
172173
173 c.yaml_parser_delete(&parser);
174
175174 const p = &Parser{
176175 .alloc = alloc,
177176 .tokens = all_events.items,