From 6565c927582133384cea94968aaf9e1dc9da7ef5 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 8 Oct 2024 15:05:11 +0200 Subject: [PATCH] fix: free as possible the tmp on the parenthese treatment --- parser/src/yarn/yarn.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/parser/src/yarn/yarn.c b/parser/src/yarn/yarn.c index e40d0c32..a9a57ccd 100644 --- a/parser/src/yarn/yarn.c +++ b/parser/src/yarn/yarn.c @@ -6,11 +6,10 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/07 18:04:13 by rparodi #+# #+# */ -/* Updated: 2024/10/08 14:51:28 by maiboyer ### ########.fr */ +/* Updated: 2024/10/08 15:04:28 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ -#include "me/printf/printf.h" #include "me/types.h" #include "me/vec/vec_token.h" #include "parser/token.h" @@ -54,6 +53,7 @@ t_error yarn(t_vec_token ts, t_vec_token *out) vec_token_push(&operator_stack, tmp); else if (tmp.type == TOK_RPAREN) { + token_free(tmp); while (vec_token_last(&operator_stack) != NULL && vec_token_last(&operator_stack)->type != TOK_LPAREN) { vec_token_pop(&operator_stack, &tmp2); @@ -61,12 +61,9 @@ t_error yarn(t_vec_token ts, t_vec_token *out) } if (!(vec_token_last(&operator_stack) != NULL && vec_token_last(&operator_stack)->type == TOK_LPAREN)) return (ERROR); - token_free(tmp); vec_token_pop(&operator_stack, &tmp); token_free(tmp); } - else - printf("TOK WTF? %s", token_name(&tmp)); } while (!vec_token_pop(&operator_stack, &tmp)) {