update: use updated parser api to fix memory leaks
This commit is contained in:
@@ -82,7 +82,7 @@ static int compile_file(const char *path, const b_arglist *args)
|
|||||||
|
|
||||||
if (status != IVY_OK) {
|
if (status != IVY_OK) {
|
||||||
b_err("failed to initialise Ivy code generator");
|
b_err("failed to initialise Ivy code generator");
|
||||||
ivy_parser_destroy(parser);
|
ivy_parser_destroy(parser, NULL);
|
||||||
ivy_lexer_destroy(lex);
|
ivy_lexer_destroy(lex);
|
||||||
ivy_file_close(src);
|
ivy_file_close(src);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -146,12 +146,12 @@ static int compile_file(const char *path, const b_arglist *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (r != 0) {
|
if (r != 0) {
|
||||||
ivy_parser_destroy(parser);
|
ivy_parser_destroy(parser, NULL);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!show_ir) {
|
if (!show_ir) {
|
||||||
ivy_parser_destroy(parser);
|
ivy_parser_destroy(parser, NULL);
|
||||||
return 0;
|
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_set_dest_file(convert, stdout);
|
||||||
mie_ir_converter_process(convert);
|
mie_ir_converter_process(convert);
|
||||||
|
|
||||||
|
mie_value_destroy(MIE_VALUE(mod));
|
||||||
mie_ir_converter_destroy(convert);
|
mie_ir_converter_destroy(convert);
|
||||||
ivy_codegen_destroy(codegen);
|
ivy_codegen_destroy(codegen);
|
||||||
|
|
||||||
ivy_parser_destroy(parser);
|
ivy_parser_destroy(parser, NULL);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ static void repl_destroy(struct repl *repl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (repl->r_parse) {
|
if (repl->r_parse) {
|
||||||
ivy_parser_destroy(repl->r_parse);
|
ivy_parser_destroy(repl->r_parse, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repl->r_lex) {
|
if (repl->r_lex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user