From b1f77b386a04ddc391615d606316416861f8ac9f Mon Sep 17 00:00:00 2001 From: Adam Joly Date: Tue, 9 Jul 2024 18:06:35 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix:=20Fixed?= =?UTF-8?q?=20some=20leak=20in=20the=20heredoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/minishell.h | 3 +++ src/exec/heredoc.c | 15 +++++++++++++-- src/get_to_free.c | 32 ++++++++++++++++++++++++++++++++ src/main.c | 4 +++- 4 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 src/get_to_free.c diff --git a/include/minishell.h b/include/minishell.h index 4a3b4ff..6b61cd8 100644 --- a/include/minishell.h +++ b/include/minishell.h @@ -39,4 +39,7 @@ void free_redir(void *redir_v); void free_token(void *token_v); void free_cmd(void *content); +t_env **get_env(t_env **env); +t_list **get_list(t_list **list); + #endif diff --git a/src/exec/heredoc.c b/src/exec/heredoc.c index 65d0c4e..68738a7 100644 --- a/src/exec/heredoc.c +++ b/src/exec/heredoc.c @@ -6,7 +6,7 @@ /* By: mmoussou +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/07/09 17:24:15 by adjoly #+# #+# */ +/* Updated: 2024/07/09 18:05:07 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "env.h" +#include "libft.h" + +t_env **get_env(t_env **env) +{ + static t_env **ret; + + if (env) + ret = env; + return (ret); +} + +t_list **get_list(t_list **list) +{ + static t_list **ret; + + if (list) + ret = list; + return (ret); +} diff --git a/src/main.c b/src/main.c index 78aa710..4d0b65a 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ /* By: mmoussou