Skip to content

Commit db18062

Browse files
committed
Fix: Crash when defining tape
As the tape wasn't allocated, there was a segmentation fault when the array was being accessed.
1 parent 6cc265c commit db18062

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

parser.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ static void parse_head(struct Lexer* const lexer, struct Head* head) {
221221

222222
// If the tape is larger than 0, the tape needs to be corrected.
223223
if(head->tape_len > 0) {
224+
head->tape = malloc(sizeof(Symbol) * head->tape_len);
225+
224226
for(size_t i = 0; i < head->tape_len; ++i) {
225227
head->tape[i] = (Symbol)find_symbol(head, head->tape_elems[i]);
226228
}

0 commit comments

Comments
 (0)