diff --git a/repl/lib_fileio.c b/repl/lib_fileio.c index f207fe1..7548259 100644 --- a/repl/lib_fileio.c +++ b/repl/lib_fileio.c @@ -486,6 +486,7 @@ static int nativeSeek(Toy_Interpreter* interpreter, Toy_LiteralArray* arguments) Toy_pushLiteralArray(&interpreter->stack, resultLiteral); // cleanup + Toy_deleteRefString(orginString); Toy_freeLiteral(resultLiteral); Toy_freeLiteral(offsetLiteral); Toy_freeLiteral(selfLiteral); diff --git a/test/scripts/lib/fileio.toy b/test/scripts/lib/fileio.toy index 925f1e5..fc14fb6 100644 --- a/test/scripts/lib/fileio.toy +++ b/test/scripts/lib/fileio.toy @@ -42,7 +42,6 @@ fn reset() { writer.close(); } - // test open and close { var reader = open(PATH, "r"); @@ -145,4 +144,8 @@ fn reset() { reader.close(); } +// standard in/out are closed to prevent memory leaks +input.close(); +output.close(); + print "All good"; \ No newline at end of file