Fix memory leak in Ground REPL, remove persistent labels to avoid UB

This commit is contained in:
2026-03-20 09:37:37 +11:00
parent 3bfea76f7d
commit be7db9d837
2 changed files with 4 additions and 1 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ build
ground
groundc
.idea
Makefile

View File

@@ -1,5 +1,5 @@
/*
* Ground REPL (when ground is ran without any arguments)
* Ground REPL (shows when ground is ran without any arguments)
* Copyright (C) 2026 DiamondNether90
*
* This program is free software: you can redistribute it and/or modify
@@ -36,6 +36,7 @@ int repl() {
scope.isMainScope = true;
while (true) {
Estr programString = CREATE_ESTR("");
*scope.labels = NULL;
// Get program
printf(">>> ");
@@ -52,6 +53,7 @@ int repl() {
GroundProgram program = createGroundProgram();
program = parseFile(programString.str);
interpretGroundProgram(&program, &scope);
freeGroundProgram(&program);
DESTROY_ESTR(programString);
}