Commit fc2f3250 authored by Arnim Läuger's avatar Arnim Läuger Committed by Marcel Stör
Browse files

add missing NULLification of serout.delay_table after luaM_freearray() (#2220)

parent ceadd30b
...@@ -228,8 +228,10 @@ static const os_param_t TIMER_OWNER = 0x6770696f; // "gpio" ...@@ -228,8 +228,10 @@ static const os_param_t TIMER_OWNER = 0x6770696f; // "gpio"
static void seroutasync_done (task_param_t arg) static void seroutasync_done (task_param_t arg)
{ {
lua_State *L = lua_getstate(); lua_State *L = lua_getstate();
luaM_freearray(L, serout.delay_table, serout.tablelen, uint32); if (serout.delay_table) {
serout.delay_table = NULL; luaM_freearray(L, serout.delay_table, serout.tablelen, uint32);
serout.delay_table = NULL;
}
if (serout.lua_done_ref != LUA_NOREF) { if (serout.lua_done_ref != LUA_NOREF) {
lua_rawgeti (L, LUA_REGISTRYINDEX, serout.lua_done_ref); lua_rawgeti (L, LUA_REGISTRYINDEX, serout.lua_done_ref);
luaL_unref (L, LUA_REGISTRYINDEX, serout.lua_done_ref); luaL_unref (L, LUA_REGISTRYINDEX, serout.lua_done_ref);
...@@ -310,6 +312,7 @@ static int lgpio_serout( lua_State* L ) ...@@ -310,6 +312,7 @@ static int lgpio_serout( lua_State* L )
} }
} while (serout.repeats--); } while (serout.repeats--);
luaM_freearray(L, serout.delay_table, serout.tablelen, uint32); luaM_freearray(L, serout.delay_table, serout.tablelen, uint32);
serout.delay_table = NULL;
} }
return 0; return 0;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment