From c53c3c33f364fbba6005fe1fa3e505ada646fc2f Mon Sep 17 00:00:00 2001 From: Filleo Date: Sat, 8 Jun 2024 17:52:50 +0200 Subject: [PATCH] solved segfault --- src/set/set.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/set/set.c b/src/set/set.c index cf07331..81f82da 100644 --- a/src/set/set.c +++ b/src/set/set.c @@ -307,8 +307,9 @@ int createRef(AST_NODE_PTR currentNode, Type** reftype) { Type * type = malloc(sizeof(Type)); - (*reftype)->kind = TypeKindReference; - (*reftype)->nodePtr = currentNode; + Type * referenceType = malloc(sizeof(Type)); + referenceType->kind = TypeKindReference; + referenceType->nodePtr = currentNode; int signal = get_type_impl(currentNode->children[0],&type); @@ -316,8 +317,8 @@ int createRef(AST_NODE_PTR currentNode, Type** reftype) { //TODO free type return SEMANTIC_ERROR; } - (*reftype)->impl.reference = type; - + referenceType->impl.reference = type; + *reftype = referenceType; return SEMANTIC_OK; }