avoid mk_artifact()-related memory leaks

Reported directly to devteam after being discovered in nerfhack.
This commit is contained in:
nhmall
2025-01-26 11:57:01 -05:00
parent ed44da351e
commit 3cca4f2707
4 changed files with 48 additions and 22 deletions
+1
View File
@@ -261,6 +261,7 @@ mk_mplayer(struct permonst *ptr, coordxy x, coordxy y, boolean special)
otmp->oerodeproof = 1;
else if (!rn2(2))
otmp->greased = 1;
/* mk_artifact() with otmp and A_NONE will never return NULL */
if (special && rn2(2))
otmp = mk_artifact(otmp, A_NONE, 99, FALSE);
/* usually increase stack size if stackable weapon */