]> granicus.if.org Git - nethack/commitdiff
Fix uninitialized variables
authorPasi Kallinen <paxed@alt.org>
Wed, 2 Mar 2022 11:29:20 +0000 (13:29 +0200)
committerPasi Kallinen <paxed@alt.org>
Wed, 2 Mar 2022 11:31:18 +0000 (13:31 +0200)
... as found by valgrind

src/do_name.c
src/priest.c
src/sp_lev.c

index 4919f7a4aa7c0ca6fef437cf1c8195598b472389..9e25089518faeb00326d7d9f22ec99df20c6941a 100644 (file)
@@ -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;
index 29886b86068a7e2fe0a54d05d6406b8c46cbc0c2..91675a57f80aa59a19b5324b545f3ce797716a12 100644 (file)
@@ -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 <foo>" fool an() into using "the " */
             Strcpy(buf2, pname);
index 19e1e1e2863dfceb25736ee6b598ed3fde4c5c6c..0e082410454769269d00b451a746fd4fef439791 100644 (file)
@@ -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);