Revert "plug a couple of memory leaks in sp_lev.c"

This reverts commit 1b7ac93930.

I just got a crash from within Lua when loading mine town and it
appears to be memory related, so back out the "plug leaks" commit
for the time being.
This commit is contained in:
PatR
2020-02-10 15:44:16 -08:00
parent 1b7ac93930
commit 9a8bea550f

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 sp_lev.c $NHDT-Date: 1581373396 2020/02/10 22:23:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.155 $ */
/* NetHack 3.6 sp_lev.c $NHDT-Date: 1580610435 2020/02/02 02:27:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.153 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -3597,12 +3597,11 @@ void
selection_free(sel)
struct selectionvar *sel;
{
if (sel) {
Free(sel->map);
sel->map = NULL;
sel->wid = sel->hei = 0;
free((genericptr_t) sel);
}
if (!sel)
return;
Free(sel->map);
sel->map = NULL;
sel->wid = sel->hei = 0;
}
struct selectionvar *
@@ -3813,6 +3812,7 @@ int dir;
selection_setpoint(x, y, ov, 1);
selection_free(tmp);
free(tmp);
}
static int FDECL((*selection_flood_check_func), (int, int));
@@ -3924,6 +3924,7 @@ boolean diagonals;
#undef SEL_FLOOD_STACK
#undef SEL_FLOOD_CHKDIR
selection_free(tmp);
free(tmp);
}
/* McIlroy's Ellipse Algorithm */
@@ -4570,7 +4571,9 @@ struct selectionvar *ov;
res = FALSE;
gotitdone:
selection_free(ov2);
free(ov2);
selection_free(ov3);
free(ov3);
return res;
}
@@ -4603,19 +4606,19 @@ ensure_way_out()
do {
ret = TRUE;
for (x = 1; x < COLNO; x++)
for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++)
if (ACCESSIBLE(levl[x][y].typ)
&& !selection_getpoint(x, y, ov)) {
if (generate_way_out_method(x, y, ov))
selection_floodfill(ov, x, y, TRUE);
if (generate_way_out_method(x,y, ov))
selection_floodfill(ov, x,y, TRUE);
ret = FALSE;
goto outhere;
}
outhere:
;
outhere: ;
} while (!ret);
selection_free(ov);
free(ov);
}
int
@@ -5188,8 +5191,10 @@ int prop;
if (sel) {
selection_iterate(sel, sel_set_wall_property, (genericptr_t) &prop);
if (freesel)
if (freesel) {
selection_free(sel);
free(sel);
}
}
}