fix suicidal panic
Some post-3.4.3 code in done() cleans up thrownobj and kickobj to plug a potential memory leak (unnoticeable one since the game is over), but they have to be free objects rather than on any list. toss_up() was leaving thrownobj defined after putting the thrown object on the floor, leading to "obj not free" panic from dealloc_obj() if threw you an object upward and it dealt fatal damage when it fell back down. (For non-fatal damage, toss_up()'s caller cleaned things up later.)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)dothrow.c 3.5 2007/03/23 */
|
||||
/* SCCS Id: @(#)dothrow.c 3.5 2007/12/03 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -873,10 +873,12 @@ boolean hitsroof;
|
||||
Strcpy(killer.name, "elementary physics"); /* "what goes up..." */
|
||||
You("turn to stone.");
|
||||
if (obj) dropy(obj); /* bypass most of hitfloor() */
|
||||
thrownobj = 0; /* now either gone or on floor */
|
||||
done(STONING);
|
||||
return obj ? TRUE : FALSE;
|
||||
}
|
||||
hitfloor(obj);
|
||||
thrownobj = 0;
|
||||
losehp(Maybe_Half_Phys(dmg), "falling object", KILLED_BY_AN);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
Reference in New Issue
Block a user