From: Pasi Kallinen Date: Wed, 2 Mar 2022 11:29:20 +0000 (+0200) Subject: Fix uninitialized variables X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13d85abde5911ce6ef3701b567cff2096fe3e5d5;p=nethack Fix uninitialized variables ... as found by valgrind --- diff --git a/src/do_name.c b/src/do_name.c index 4919f7a4a..9e2508951 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -690,7 +690,7 @@ getpos(coord *ccp, boolean force, const char *goal) char mMoOdDxX[13]; int result = 0; 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 show_goal_msg = FALSE; boolean hilite_state = FALSE; @@ -1764,7 +1764,7 @@ x_monnam( /* priests and minions: don't even use this function */ if (mtmp->ispriest || mtmp->isminion) { - char priestnambuf[BUFSZ]; + char priestnambuf[BUFSZ] = DUMMY; char *name; long save_prop = EHalluc_resistance; unsigned save_invis = mtmp->minvis; diff --git a/src/priest.c b/src/priest.c index 29886b860..91675a57f 100644 --- a/src/priest.c +++ b/src/priest.c @@ -316,7 +316,7 @@ priestname( if (article == ARTICLE_THE) { Strcat(pname, "the "); } else { - char buf2[BUFSZ]; + char buf2[BUFSZ] = DUMMY; /* don't let "Angel of " fool an() into using "the " */ Strcpy(buf2, pname); diff --git a/src/sp_lev.c b/src/sp_lev.c index 19e1e1e28..0e0824104 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -4095,6 +4095,7 @@ lspo_trap(lua_State *L) create_des_coder(); tmptrap.spider_on_web = TRUE; + tmptrap.seen = FALSE; if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) { const char *trapstr = luaL_checkstring(L, 1);