From 1603ea179833a3865be585322cc33b2b4d2d47c4 Mon Sep 17 00:00:00 2001 From: Add00 Date: Mon, 14 Aug 2023 23:09:13 -0400 Subject: [PATCH] mostly fixed sanitization issue --- repl/lib_fileio.c | 1 + test/scripts/lib/fileio.toy | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) 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