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.
master
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
1 changed files with 1 additions and 1 deletions

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