update: use updated parser api to fix memory leaks

This commit is contained in:
2025-04-17 23:16:16 +01:00
parent 25c1fbd44b
commit 78817b6b8c
2 changed files with 6 additions and 5 deletions

View File

@@ -82,7 +82,7 @@ static int compile_file(const char *path, const b_arglist *args)
if (status != IVY_OK) {
b_err("failed to initialise Ivy code generator");
ivy_parser_destroy(parser);
ivy_parser_destroy(parser, NULL);
ivy_lexer_destroy(lex);
ivy_file_close(src);
return -1;
@@ -146,12 +146,12 @@ static int compile_file(const char *path, const b_arglist *args)
}
if (r != 0) {
ivy_parser_destroy(parser);
ivy_parser_destroy(parser, NULL);
return r;
}
if (!show_ir) {
ivy_parser_destroy(parser);
ivy_parser_destroy(parser, NULL);
return 0;
}
@@ -175,10 +175,11 @@ static int compile_file(const char *path, const b_arglist *args)
mie_ir_converter_set_dest_file(convert, stdout);
mie_ir_converter_process(convert);
mie_value_destroy(MIE_VALUE(mod));
mie_ir_converter_destroy(convert);
ivy_codegen_destroy(codegen);
ivy_parser_destroy(parser);
ivy_parser_destroy(parser, NULL);
return r;
}

View File

@@ -101,7 +101,7 @@ static void repl_destroy(struct repl *repl)
}
if (repl->r_parse) {
ivy_parser_destroy(repl->r_parse);
ivy_parser_destroy(repl->r_parse, NULL);
}
if (repl->r_lex) {