Working now without leaks :D

This commit is contained in:
Maieul BOYER 2024-04-30 16:22:11 +02:00
commit 4518f5a727
No known key found for this signature in database
5 changed files with 70 additions and 92 deletions

View file

@ -6,22 +6,22 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/29 11:35:51 by rparodi #+# #+# */
/* Updated: 2024/04/30 16:07:48 by maiboyer ### ########.fr */
/* Updated: 2024/04/30 16:16:55 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/minishell.h"
void ft_free(void *ptr)
void ft_free(void *ptr)
{
if (!ptr)
free(ptr);
ptr = NULL;
}
void ft_free_strs(t_str *strs)
void ft_free_strs(t_str *strs)
{
t_usize i;
t_usize i;
i = 0;
while (strs[i])
@ -32,12 +32,15 @@ void ft_free_strs(t_str *strs)
ft_free(strs);
}
void ft_free_utils(t_utils *s)
void ft_free_utils(t_utils *s)
{
(void)(s);
if (s->str_input)
free(s->str_input);
ts_parser_delete(s->parser.parser);
}
void ft_exit(t_utils *maiboyerlpb, t_u8 exit_status)
void ft_exit(t_utils *maiboyerlpb, t_u8 exit_status)
{
if (maiboyerlpb != NULL)
ft_free_utils(maiboyerlpb);