From 1e3e4fb6492832048b484ffe784613a16713f1d2 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 12 Mar 2019 07:56:56 +0000 Subject: HPChange Reason: Fix push after free, and type being overwritten (#8359) * HPChange Reason: Fix push after free, and type being overwritten Fixes #8227 and #8344 --- src/script/lua_api/l_object.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/script/lua_api') diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 9edb2f4f8..b3ed39c7c 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -257,6 +257,9 @@ int ObjectRef::l_set_hp(lua_State *L) if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER) getServer(L)->SendPlayerHPOrDie((PlayerSAO *)co, reason); + if (reason.hasLuaReference()) + luaL_unref(L, LUA_REGISTRYINDEX, reason.lua_reference); + // Return return 0; } -- cgit v1.2.3