Fix leak and possible segfault in minetest.set_mapgen_params