diff options
| author | Christopher Uhlig | 2025-01-25 13:01:10 +0100 |
|---|---|---|
| committer | Christopher Uhlig | 2025-01-25 13:01:10 +0100 |
| commit | 87b90103930d83d74baa998866b0995cb8887d51 (patch) | |
| tree | 0eb876341c2794f2165b83c1d339fb3b38e9f711 /src/free_token.c | |
| parent | 18fb7cb8ae69fc3439266a154aa6b0f947d6805d (diff) | |
| download | minishell-87b90103930d83d74baa998866b0995cb8887d51.tar.gz minishell-87b90103930d83d74baa998866b0995cb8887d51.zip | |
fixed leaks in tokenizer and collectargs also fixed seg for < > and improved value add by $ use
Diffstat (limited to 'src/free_token.c')
| -rw-r--r-- | src/free_token.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/src/free_token.c b/src/free_token.c index 2292eb0..a63e750 100644 --- a/src/free_token.c +++ b/src/free_token.c @@ -6,7 +6,7 @@ /* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/27 14:38:57 by dkaiser #+# #+# */ -/* Updated: 2025/01/22 17:28:31 by dkaiser ### ########.fr */ +/* Updated: 2025/01/25 11:36:59 by chuhlig ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,12 +19,7 @@ void free_token(t_token *token) token->previous->next = NULL; if (token->next != NULL) token->next->previous = NULL; - // if (token->previous == NULL && token->next == NULL) - // { - // if (token->type == STRING_TOKEN && token->content.string != NULL) - // free(token->content.string); // Ensure content is freed - // } - free(token);//maybe free token + free(token); token = NULL; } @@ -34,13 +29,12 @@ void free_token2(t_token *token) token->previous->next = NULL; if (token->next != NULL) token->next->previous = NULL; - if (token->type == STRING_TOKEN && token->content.string != NULL) - free(token->content.string); // Ensure content is freed - free(token);//maybe free token + if (token->type == STRING_TOKEN && token->content.string != NULL) + free(token->content.string); + free(token); token = NULL; } - void free_token_and_connect(t_token *token) { if (token->previous != NULL) @@ -58,7 +52,7 @@ void free_token_and_connect2(t_token *token) if (token->next != NULL) token->next->previous = token->previous; if (token->type == STRING_TOKEN && token->content.string != NULL) - free(token->content.string); // Ensure content is freed + free(token->content.string); free(token); token = NULL; } @@ -72,14 +66,3 @@ void free_tokens(t_token *tokens) } free_token2(tokens); } -// void free_tokens(t_token *tokens) -// { -// t_token *tmp; - -// while (tokens) -// { -// tmp = tokens; -// tokens = tokens->next; -// free_token(tmp); // Ensure each token is freed -// } -// } |
