Fix memory leak & C stack overflow

Before this patch, when placing a fire above a node that would turn it
into eternal fire (e.g. Netherrack or Magma) the spawn_fire() function
would call itself infinitely via the on_construct() handler of eternal
fire – because the latter called spawn_fire() itself.

On an x86 machine, this caused a memory leak, hanging Minetest. On an
x86_64 machine though, Minetest crashed immediately, showing an error
message about a stack overflow.
This commit is contained in:
cora 2022-02-11 13:27:07 +01:00 committed by Nils Dagsson Moskopp
parent 4647710945
commit f5ba6f5649
No known key found for this signature in database
GPG key ID: A3BC671C35191080

View file

@ -134,7 +134,7 @@ minetest.register_node("mcl_fire:fire", {
local dim = mcl_worlds.pos_to_dimension(bpos)
if under == "mcl_nether:magma" or under == "mcl_nether:netherrack" or (under == "mcl_core:bedrock" and dim == "end") then
spawn_fire(pos)
minetest.set_node(pos, {name="mcl_fire:eternal_fire"})
end
if minetest.get_modpath("mcl_portals") then