diff options
author | rubenwardy <rw@rubenwardy.com> | 2019-03-12 07:56:56 +0000 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2019-03-12 20:25:48 +0000 |
commit | 444ec1e4128e68523f1bbf51aa03e8bf2006156c (patch) | |
tree | 2b09dda5ea4135b0a3b38e563b7c2d016d94dc44 /src/script/lua_api | |
parent | 82739f4d7d634eaccdc8414382da5d55ae39734d (diff) | |
download | minetest-444ec1e4128e68523f1bbf51aa03e8bf2006156c.tar.gz minetest-444ec1e4128e68523f1bbf51aa03e8bf2006156c.tar.bz2 minetest-444ec1e4128e68523f1bbf51aa03e8bf2006156c.zip |
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
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_object.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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; } |