AP_Scripting: ensure new user data is zero

this prevents use of uninitialised data for user objects created in
lua, giving more predictable behaviour
This commit is contained in:
Andrew Tridgell 2023-03-09 10:39:37 +11:00 committed by Peter Barker
parent 1530dbde3d
commit 615838a7d4

View File

@ -1189,7 +1189,9 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
api_incr_top(L);
luaC_checkGC(L);
lua_unlock(L);
return getudatamem(u);
void *udata = getudatamem(u);
memset(udata, 0, size);
return udata;
}