aboutsummaryrefslogtreecommitdiff
path: root/src/token.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/token.c')
-rw-r--r--src/token.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/token.c b/src/token.c
index 26af598..ece32f4 100644
--- a/src/token.c
+++ b/src/token.c
@@ -14,6 +14,12 @@ token_t* token_init(int type, char* val) {
}
void token_destroy(token_t* token) {
+ if (token->nxt) {
+ token_destroy(token->nxt);
+ token->nxt = NULL;
+ }
+
+ free(token->val);
free(token);
}