fix: heap-use-after-free and memory leaks on erorr cases
This commit is contained in:
parent
f0b39535fb
commit
5740195cb3
4 changed files with 18 additions and 11 deletions
|
|
@ -66,8 +66,11 @@ static int main_loop(struct lexer_context *ctx, struct args_options *options,
|
|||
if (command_ast == NULL)
|
||||
return err_input(&vars);
|
||||
|
||||
// === free
|
||||
|
||||
ast_free(&command_ast);
|
||||
parser_close();
|
||||
hash_map_free(&vars);
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
|
@ -120,9 +123,5 @@ int main(int argc, char **argv)
|
|||
|
||||
return_code = main_loop(&ctx, &options, vars);
|
||||
|
||||
// === free
|
||||
|
||||
hash_map_free(&vars);
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue