Fix uninitialized variables

... as found by valgrind
This commit is contained in:
Pasi Kallinen
2022-03-02 13:31:18 +02:00
parent 23d09e6678
commit 13d85abde5
3 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -690,7 +690,7 @@ getpos(coord *ccp, boolean force, const char *goal)
char mMoOdDxX[13]; char mMoOdDxX[13];
int result = 0; int result = 0;
int cx, cy, i, c; int cx, cy, i, c;
int sidx, tx, ty; int sidx, tx = u.ux, ty = u.uy;
boolean msg_given = TRUE; /* clear message window by default */ boolean msg_given = TRUE; /* clear message window by default */
boolean show_goal_msg = FALSE; boolean show_goal_msg = FALSE;
boolean hilite_state = FALSE; boolean hilite_state = FALSE;
@@ -1764,7 +1764,7 @@ x_monnam(
/* priests and minions: don't even use this function */ /* priests and minions: don't even use this function */
if (mtmp->ispriest || mtmp->isminion) { if (mtmp->ispriest || mtmp->isminion) {
char priestnambuf[BUFSZ]; char priestnambuf[BUFSZ] = DUMMY;
char *name; char *name;
long save_prop = EHalluc_resistance; long save_prop = EHalluc_resistance;
unsigned save_invis = mtmp->minvis; unsigned save_invis = mtmp->minvis;
+1 -1
View File
@@ -316,7 +316,7 @@ priestname(
if (article == ARTICLE_THE) { if (article == ARTICLE_THE) {
Strcat(pname, "the "); Strcat(pname, "the ");
} else { } else {
char buf2[BUFSZ]; char buf2[BUFSZ] = DUMMY;
/* don't let "Angel of <foo>" fool an() into using "the " */ /* don't let "Angel of <foo>" fool an() into using "the " */
Strcpy(buf2, pname); Strcpy(buf2, pname);
+1
View File
@@ -4095,6 +4095,7 @@ lspo_trap(lua_State *L)
create_des_coder(); create_des_coder();
tmptrap.spider_on_web = TRUE; tmptrap.spider_on_web = TRUE;
tmptrap.seen = FALSE;
if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) { if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) {
const char *trapstr = luaL_checkstring(L, 1); const char *trapstr = luaL_checkstring(L, 1);