fix memory leaks in parser

This commit is contained in:
corey 2023-11-10 15:46:46 -06:00
parent 8355dcab12
commit 1561c05a68
2 changed files with 5 additions and 1 deletions

View File

@ -8,7 +8,7 @@ OBJS= str.o tok.o vec.o lex.o pnode.o reg.o mem.o state.o err.o x86_64.o
LIB= libpar.a
TESTS_x86_64= $(notdir $(basename $(shell find tests/x86_64/ -name '*.par')))
PAR= ./par
VALGRIND= valgrind --log-file=$(@D)/valgrind.$*
VALGRIND= valgrind --leak-check=full --log-file=$(@D)/valgrind.$*
#
# MAIN TARGETS

View File

@ -51,7 +51,11 @@ void pnode_free(PNode*n)
vec_free(&n->pnodes);
if(n->tokens.buffer)
{
for(size_t i=0;i<n->tokens.size;++i)
tok_free(vec_at(&n->tokens,i,Tok*));
vec_free(&n->tokens);
}
}
PNode*pnode_pushnode(PNode*n)