Fix: leak with env hashmap
This commit is contained in:
parent
f86947a852
commit
b5c7344851
1 changed files with 6 additions and 6 deletions
|
|
@ -6,11 +6,13 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/29 11:35:51 by rparodi #+# #+# */
|
||||
/* Updated: 2024/05/02 13:46:39 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/04 19:24:44 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../includes/minishell.h"
|
||||
#include "app/env.h"
|
||||
#include "me/hashmap/hashmap_env.h"
|
||||
|
||||
void ts_parser_delete(t_first_parser *self);
|
||||
|
||||
|
|
@ -18,7 +20,6 @@ void ft_free(void *ptr)
|
|||
{
|
||||
if (!ptr)
|
||||
free(ptr);
|
||||
ptr = NULL;
|
||||
}
|
||||
|
||||
void ft_free_strs(t_str *strs)
|
||||
|
|
@ -27,10 +28,7 @@ void ft_free_strs(t_str *strs)
|
|||
|
||||
i = 0;
|
||||
while (strs[i])
|
||||
{
|
||||
ft_free(strs[i]);
|
||||
i++;
|
||||
}
|
||||
ft_free(strs[i++]);
|
||||
ft_free(strs);
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +39,8 @@ void ft_free_utils(t_utils *s)
|
|||
free(s->str_input);
|
||||
if (s->path)
|
||||
ft_free_strs(s->path);
|
||||
if (s->env)
|
||||
drop_hashmap_env(s->env);
|
||||
ts_parser_delete(s->parser.parser);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue