From f5ba6f564925ebf5ce0de3c8c905ef24a8123ab5 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 11 Feb 2022 13:27:07 +0100 Subject: [PATCH] Fix memory leak & C stack overflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- mods/ITEMS/mcl_fire/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_fire/init.lua b/mods/ITEMS/mcl_fire/init.lua index 8b606561..2eed0843 100644 --- a/mods/ITEMS/mcl_fire/init.lua +++ b/mods/ITEMS/mcl_fire/init.lua @@ -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