From b5c73448517b7f9a9fb64d60ae2e16c7aa00875d Mon Sep 17 00:00:00 2001 From: Maix0 Date: Sat, 4 May 2024 19:25:04 +0200 Subject: [PATCH] Fix: leak with env hashmap --- sources/ft_exit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sources/ft_exit.c b/sources/ft_exit.c index 89fb7da1..51b574cc 100644 --- a/sources/ft_exit.c +++ b/sources/ft_exit.c @@ -6,11 +6,13 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); }