From 4e81fb861a79c9373b070176649bc0f4f8dfa850 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 9 Jun 2020 17:57:57 +0200 Subject: Fixing 2 leaks in preprocessor and norming it --- src/lexer/token.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/lexer/token.c') diff --git a/src/lexer/token.c b/src/lexer/token.c index bf534a4..6c6a184 100644 --- a/src/lexer/token.c +++ b/src/lexer/token.c @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/09 13:38:08 by charles #+# #+# */ -/* Updated: 2020/06/09 13:39:27 by charles ### ########.fr */ +/* Updated: 2020/06/09 17:55:23 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,7 +17,7 @@ t_token *token_new(enum e_token_tag tag, char *content) t_token *token; if (content == NULL - || (token = malloc(sizeof(t_token))) == NULL) + || (token = (t_token*)malloc(sizeof(t_token))) == NULL) return (NULL); if ((token->content = ft_strdup(content)) == NULL) { @@ -27,3 +27,9 @@ t_token *token_new(enum e_token_tag tag, char *content) token->tag = tag; return token; } + +void token_destroy(t_token *token) +{ + free(token->content); + free(token); +} -- cgit