Resolve bug #1457429.
authorMichael Poole <mdpoole@troilus.org>
Sat, 25 Mar 2006 03:46:56 +0000 (03:46 +0000)
committerMichael Poole <mdpoole@troilus.org>
Sat, 25 Mar 2006 03:46:56 +0000 (03:46 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1633 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/ircd_signal.c
ircd/jupe.c
ircd/list.c
ircd/whowas.c

index c362d6996a00493b08ed14db5e2aad43d9d6c310..9de184392816088323b74f679d7d9bb64f09c1aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-03-24  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/ircd_signal.c (alloc_crec): Zero-fill returned
+       ChildRecord structs.
+
+       * ircd/jupe.c (make_jupe): Zero-fill newly allocated jupes.
+
+       * ircd/list.c (make_link): Zero-fill returned SLink structs.
+
+       * ircd/whowas.c (whowas_init): Delete function.
+       (whowas_alloc): Rewrite to follow the more common pattern and to
+       zero-fill returned Whowas structs.
+
 2006-03-23  Kevin L. Mitchell  <klmitch@mit.edu>
 
        * ircd/s_auth.c: rewrite iauth_read(), spliting out the parsing
index 89a05c48a668a44aac31f89e78185123de7c9bc3..650102ed1f9bf32433c4c02843f64b0c1648353a 100644 (file)
@@ -134,6 +134,7 @@ static struct ChildRecord *alloc_crec(void)
     crec = MyCalloc(1, sizeof(*crec));
   }
 
+  memset(crec, 0, sizeof(*crec));
   crec->next = NULL;
   return crec;
 }
index 8cdaa9edad061875052ea4e3e0bacee0c95321c3..243ae626df4fd5072160ef12934b922c15575e6e 100644 (file)
@@ -65,6 +65,7 @@ make_jupe(char *server, char *reason, time_t expire, time_t lastmod,
   ajupe = (struct Jupe*) MyMalloc(sizeof(struct Jupe)); /* alloc memory */
   assert(0 != ajupe);
 
+  memset(ajupe, 0, sizeof(*ajupe));
   DupString(ajupe->ju_server, server); /* copy vital information */
   DupString(ajupe->ju_reason, reason);
   ajupe->ju_expire = expire;
index cbf98c5eedccacdb65227182337ca82dd63eb06b..f485ec0e3bafcddaeb18ce3c229efbc291d3cbae 100644 (file)
@@ -436,6 +436,7 @@ struct SLink* make_link(void)
   }
   assert(0 != lp);
   links.inuse++;
+  memset(lp, 0, sizeof(*lp));
   return lp;
 }
 
index 139202714c0bc170e4d202e6bf33c6f4d4a9cd26..fed3fffe748325630e016e8aa9efa6971357ac80 100644 (file)
@@ -209,18 +209,6 @@ whowas_free(struct Whowas *ww)
   wwList.ww_alloc--;
 }
 
-/** Initialize a whowas record.
- * @param[in,out] ww Whowas record to initialize.
- * @return The pointer \a ww.
- */
-static struct Whowas *
-whowas_init(struct Whowas *ww)
-{
-  if (ww)
-    memset(ww, 0, sizeof(*ww));
-  return ww;
-}
-
 /** Return a fresh Whowas record.
  * If the total number of records is smaller than determined by
  * FEAT_NICKNAMEHISTORYLENGTH, allocate a new one.  Otherwise,
@@ -230,11 +218,20 @@ whowas_init(struct Whowas *ww)
 static struct Whowas *
 whowas_alloc(void)
 {
-  if (wwList.ww_alloc >= feature_int(FEAT_NICKNAMEHISTORYLENGTH))
-    return whowas_init(whowas_clean(wwList.ww_tail));
+  struct Whowas *ww;
 
-  wwList.ww_alloc++; /* going to allocate a new one... */
-  return whowas_init((struct Whowas *) MyMalloc(sizeof(struct Whowas)));
+  if (wwList.ww_alloc >= feature_int(FEAT_NICKNAMEHISTORYLENGTH)) {
+    /* reclaim the oldest whowas entry */
+    ww = whowas_clean(wwList.ww_tail);
+  } else {
+    /* allocate a new one */
+    wwList.ww_alloc++;
+    ww = (struct Whowas *) MyMalloc(sizeof(struct Whowas));
+  }
+
+  assert(ww != NULL);
+  memset(ww, 0, sizeof(*ww));
+  return ww;
 }
 
 /** If necessary, trim the whowas list.