aboutsummaryrefslogtreecommitdiff
path: root/src/lua.c
diff options
context:
space:
mode:
authoramelia squires <[email protected]>2025-09-27 04:11:49 -0500
committeramelia squires <[email protected]>2025-09-27 04:11:49 -0500
commite3a798740c2d64d0ac0dd4a08ebfec9d5a1c3cf8 (patch)
tree4fdf70facae0efe392a740438f15c85758c7f9c2 /src/lua.c
parent6acf870551b48679cc5c4d430502f1f8a719eafd (diff)
leaks and memory fixes
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lua.c b/src/lua.c
index 2623e29..c51a906 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -51,7 +51,7 @@ int _stream_read(lua_State* L){
}
lua_pushlstring(L, cont->c, cont->len);
- free(cont);
+ str_free(cont);
return 1;
}
@@ -185,6 +185,9 @@ void luaI_deepcopy(lua_State* src, lua_State* dest, enum deep_copy_flags flags){
case LUA_TBOOLEAN:
lua_pushboolean(dest, lua_toboolean(src, -1));
break;
+ case LUA_TNIL:
+ lua_pushnil(dest);
+ break;
case LUA_TSTRING:;
size_t slen;
const char* ss = lua_tolstring(src, -1, &slen);
@@ -403,6 +406,7 @@ void luaI_copyvars(lua_State* from, lua_State* to){
env_table(from, x != 0);
luaI_deepcopy(from, to, SKIP_GC | SKIP_LOCALS);
+ lua_pop(from, 1);
int idx = lua_gettop(to);
lua_pushglobaltable(to);
int tidx = lua_gettop(to);