commit 56b02405f9b11a3ef74d2ba3e0491173b180018c parent 30f4370c24502f80c84f681d366e25a6710a9269 Author: Sebastian <sebastian@sebsite.pw> Date: Thu, 17 Feb 2022 15:14:26 -0500 xml: fix memory leak Signed-off-by: Sebastian <sebastian@sebsite.pw> Diffstat:
M | format/xml/parser.ha | | | 7 | ++++++- |
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/format/xml/parser.ha b/format/xml/parser.ha @@ -35,7 +35,12 @@ export fn parse(in: io::handle) (*parser | error) = { par.in = alloc(bufio::buffered(in, par.buf[..], [])); par.close = true; }; - prolog(par)?; + match (prolog(par)) { + case void => void; + case let err: error => + parser_free(par); + return err; + }; return par; };