From 850410ef9564b076a787b871fd6cf861d3dd37f5 Mon Sep 17 00:00:00 2001 From: ame Date: Sat, 20 Apr 2024 01:23:13 -0500 Subject: working on mem saftey --- src/lua.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/lua.c') diff --git a/src/lua.c b/src/lua.c index 395481f..22a5ef3 100644 --- a/src/lua.c +++ b/src/lua.c @@ -74,11 +74,13 @@ void i_dcopy(lua_State* src, lua_State* dest, void* _seen){ return; } + int *sp = malloc(sizeof * sp); + //lua_pushinteger(dest, 55); int r = luaL_ref(dest, LUA_REGISTRYINDEX); lua_rawgeti(dest, LUA_REGISTRYINDEX, r); - //*sp = r; - parray_set(seen, aauwu, (void*)&r); + *sp = r; + parray_set(seen, aauwu, sp); //printf("saved %i\n", *sp); //for(int i = 0; i != seen->len; i++){ @@ -126,7 +128,7 @@ void i_dcopy(lua_State* src, lua_State* dest, void* _seen){ lua_pushnil(dest); break; } - if(wnull) parray_clear(seen, NONE); + if(wnull) parray_clear(seen, FREE); //lua_settop(src, old_top); _seen = seen; } -- cgit v1.2.3