aboutsummaryrefslogtreecommitdiff
path: root/src/new_token.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/new_token.c')
-rw-r--r--src/new_token.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/new_token.c b/src/new_token.c
index bd65b9d..c5497b4 100644
--- a/src/new_token.c
+++ b/src/new_token.c
@@ -11,6 +11,7 @@
/* ************************************************************************** */
#include "token.h"
+#include "libft.h"
t_token *new_token(int type, t_token *previous, t_token *next)
{
@@ -35,8 +36,11 @@ t_token *new_str_token(char *str, t_token *previous, t_token *next)
token = new_token(STRING_TOKEN, previous, next);
if (token == NULL)
+ {
+ free(str);
return (NULL);
- token->content.string = str;
+ }
+ token->content.string = ft_strdup(str);
return (token);
}