From c258fa607725ffce13ab2616744fc6f8007aa4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Wed, 19 Mar 2025 16:26:45 +0100 Subject: [PATCH] fix(simple_cmd): did not free redirection list correctly --- src/parser/simple_cmd/simple_cmd.c | 3 ++- src/postprocess/redirections/redirection_list.c | 4 ++-- src/postprocess/redirections/redirection_list.h | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/parser/simple_cmd/simple_cmd.c b/src/parser/simple_cmd/simple_cmd.c index 670c60e..629fd92 100644 --- a/src/parser/simple_cmd/simple_cmd.c +++ b/src/parser/simple_cmd/simple_cmd.c @@ -6,7 +6,7 @@ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/02/21 12:30:07 by khais #+# #+# */ -/* Updated: 2025/03/19 14:28:36 by khais ### ########.fr */ +/* Updated: 2025/03/19 16:49:12 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -36,6 +36,7 @@ void simple_cmd_destroy(t_simple_cmd *cmd) if (cmd == NULL) return ; wordlist_destroy(cmd->words); + redir_list_destroy(cmd->redirections); free(cmd); } diff --git a/src/postprocess/redirections/redirection_list.c b/src/postprocess/redirections/redirection_list.c index 8af4d46..0bc789b 100644 --- a/src/postprocess/redirections/redirection_list.c +++ b/src/postprocess/redirections/redirection_list.c @@ -6,7 +6,7 @@ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/03/07 14:29:53 by khais #+# #+# */ -/* Updated: 2025/03/20 11:38:46 by khais ### ########.fr */ +/* Updated: 2025/03/20 11:39:41 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -34,7 +34,7 @@ static t_redir_list *redir_list_create(t_redirection *item) /* ** free all memory associated with this redir list */ -static void redir_list_destroy(t_redir_list *lst) +void redir_list_destroy(t_redir_list *lst) { t_redir_list *prev; diff --git a/src/postprocess/redirections/redirection_list.h b/src/postprocess/redirections/redirection_list.h index a445b60..ccaf006 100644 --- a/src/postprocess/redirections/redirection_list.h +++ b/src/postprocess/redirections/redirection_list.h @@ -6,7 +6,7 @@ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/03/07 14:29:32 by khais #+# #+# */ -/* Updated: 2025/03/19 12:10:54 by khais ### ########.fr */ +/* Updated: 2025/03/19 16:49:52 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,6 +24,7 @@ typedef struct s_redirection_list } t_redir_list; t_redir_list *redir_list_push(t_redir_list *lst, t_redirection *item); +void redir_list_destroy(t_redir_list *lst); void redir_list_debug(t_redir_list *lst, t_buffer *leader, bool is_last);