From 3d358976015fc18ad188b08642328a47c884b20d Mon Sep 17 00:00:00 2001 From: Johannes Pekkila Date: Wed, 27 Nov 2019 09:16:32 +0100 Subject: [PATCH] The structure holding an abstract syntax tree node (acc) was not properly initialized to 0, fixed --- acc/src/ast.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/acc/src/ast.h b/acc/src/ast.h index b59c8b7..1df3e2e 100644 --- a/acc/src/ast.h +++ b/acc/src/ast.h @@ -56,7 +56,7 @@ typedef struct astnode_s { static inline ASTNode* astnode_create(const NodeType type, ASTNode* lhs, ASTNode* rhs) { - ASTNode* node = malloc(sizeof(node[0])); + ASTNode* node = calloc(1, sizeof(node[0])); static int id_counter = 0; node->id = id_counter++; @@ -65,6 +65,7 @@ astnode_create(const NodeType type, ASTNode* lhs, ASTNode* rhs) node->rhs = rhs; node->buffer = NULL; + node->token = 0; node->prefix = node->infix = node->postfix = 0; if (lhs)