shithub: lu9

Download patch

ref: 07fda22831e6aa8a12455d7357f3f03d6376ed67
parent: d64355daad296b73f79e3a77662ea7c611f815a5
author: kvik <[email protected]>
date: Tue Aug 3 10:10:47 EDT 2021

lu9: fix memory leak in REPL

--- a/lu9.c
+++ b/lu9.c
@@ -108,7 +108,9 @@
 		sysfatal("Binit: %r");
 	r = LUA_OK;
 	while(fprint(2, "> "), (ln = Brdstr(&bin, '\n', 1)) != nil){
-		if(luaL_loadstring(L, ln) != LUA_OK){
+		r = luaL_loadstring(L, ln);
+		free(ln);
+		if(r != LUA_OK){
 			luaerror(L);
 			continue;
 		}