fix: heap-use-after-free and memory leaks on erorr cases

This commit is contained in:
matteo 2026-01-30 12:21:29 +01:00 committed by Matteo Flebus
parent f0b39535fb
commit 5740195cb3
4 changed files with 18 additions and 11 deletions

View file

@ -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;
}