Skip to content

Commit

Permalink
fix: Fix memory leak by freeing ast before reading new input
Browse files Browse the repository at this point in the history
  • Loading branch information
itislu committed Dec 26, 2023
1 parent b1bbbae commit f2e0c5f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lyeh <lyeh@student.42vienna.com> +#+ +:+ +#+ */
/* By: ldulling <ldulling@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/08 16:09:49 by lyeh #+# #+# */
/* Updated: 2023/12/23 20:10:15 by lyeh ### ########.fr */
/* Updated: 2023/12/26 18:21:34 by ldulling ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -40,7 +40,10 @@ int main(int argc, char **argv, char **env)
return (ft_clean_shell(&shell), EXIT_FAILED);
if (!ft_parse(&shell))
return (ft_clean_shell(&shell), EXIT_FAILED);
print_ast_bfs(shell.ast);

// Free ast after executor
free_ast_node(shell.ast);
shell.ast = NULL;
// ft_clean_shell(&shell);
// do executor
}
Expand Down

0 comments on commit f2e0c5f

Please sign in to comment.