forked from ground/ground
Fix memory leak in Ground REPL, remove persistent labels to avoid UB
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ build
|
|||||||
ground
|
ground
|
||||||
groundc
|
groundc
|
||||||
.idea
|
.idea
|
||||||
|
Makefile
|
||||||
|
|||||||
@@ -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
|
* Copyright (C) 2026 DiamondNether90
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@@ -36,6 +36,7 @@ int repl() {
|
|||||||
scope.isMainScope = true;
|
scope.isMainScope = true;
|
||||||
while (true) {
|
while (true) {
|
||||||
Estr programString = CREATE_ESTR("");
|
Estr programString = CREATE_ESTR("");
|
||||||
|
*scope.labels = NULL;
|
||||||
|
|
||||||
// Get program
|
// Get program
|
||||||
printf(">>> ");
|
printf(">>> ");
|
||||||
@@ -52,6 +53,7 @@ int repl() {
|
|||||||
GroundProgram program = createGroundProgram();
|
GroundProgram program = createGroundProgram();
|
||||||
program = parseFile(programString.str);
|
program = parseFile(programString.str);
|
||||||
interpretGroundProgram(&program, &scope);
|
interpretGroundProgram(&program, &scope);
|
||||||
|
freeGroundProgram(&program);
|
||||||
|
|
||||||
DESTROY_ESTR(programString);
|
DESTROY_ESTR(programString);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user