fix: commands list was not being freed if the command line ended in pipe

error was reported but commands were being executed as the list was not
being freed
This commit is contained in:
2026-02-13 09:29:24 +01:00
parent 8f92cf269c
commit d248819dfe

View File

@@ -6,7 +6,7 @@
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */ /* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/22 18:37:38 by sede-san #+# #+# */ /* Created: 2025/10/22 18:37:38 by sede-san #+# #+# */
/* Updated: 2026/02/13 08:17:43 by sede-san ### ########.fr */ /* Updated: 2026/02/13 09:22:58 by sede-san ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -99,7 +99,10 @@ static t_list *parse_tokens(
if (current_token != NULL) if (current_token != NULL)
{ {
if (current_token->next == NULL) if (current_token->next == NULL)
syntax_error_unexpected_token((t_token *)current_token->content); {
ft_lstclear(&commands, (void (*)(void *))command_clear);
return (syntax_error_unexpected_token((t_token *)current_token->content), NULL);
}
current_token = current_token->next; current_token = current_token->next;
} }
} }