]> granicus.if.org Git - neomutt/commitdiff
Initialize some more memory. Noted by Vsevolod Volkov
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 12 Apr 2000 16:32:26 +0000 (16:32 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 12 Apr 2000 16:32:26 +0000 (16:32 +0000)
<vvv@lucky.net>.

browser.c

index 7a7e2f566e613529a1b3ff1f98e351f4736a8466..ebb4f5e40c31deafc12c7616de6f9e2e5cefe9b5 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -313,6 +313,8 @@ static void add_folder (MUTTMENU *m, struct browser_state *state,
     /* need to allocate more space */
     safe_realloc ((void **) &state->entry,
                  sizeof (struct folder_file) * (state->entrymax += 256));
+    memset (&state->entry[state->entrylen], 0,
+           sizeof (struct folder_file) * 256);
     if (m)
       m->data = state->entry;
   }
@@ -340,8 +342,7 @@ static void init_state (struct browser_state *state, MUTTMENU *menu)
 {
   state->entrylen = 0;
   state->entrymax = 256;
-  state->entry = (struct folder_file *) safe_malloc (sizeof (struct folder_file) * state->entrymax);
-  memset (state->entry, 0, sizeof (struct folder_file) * state->entrymax);
+  state->entry = (struct folder_file *) safe_calloc (state->entrymax, sizeof (struct folder_file));
 #ifdef USE_IMAP
   state->imap_browse = 0;
 #endif