about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-30 18:55:10 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-30 18:55:10 +0000
commiteb5a1f61c46ed5a442a22ba847955730dd52f624 (patch)
treef9c0619df8c9517e27bc4569bcd14f238af3a372
parentd7d5cd1eaba9443feb139f0e2a7917cb9f162511 (diff)
downloadglibc-eb5a1f61c46ed5a442a22ba847955730dd52f624.tar.gz
glibc-eb5a1f61c46ed5a442a22ba847955730dd52f624.tar.xz
glibc-eb5a1f61c46ed5a442a22ba847955730dd52f624.zip
Do a better job in initializing dynamic memory.
-rw-r--r--catgets/gencat.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/catgets/gencat.c b/catgets/gencat.c
index 20a3e6ac55..e1396a12cd 100644
--- a/catgets/gencat.c
+++ b/catgets/gencat.c
@@ -264,16 +264,13 @@ read_input_file (struct catalog *current, const char *fname)
   /* If we haven't seen anything yet, allocate result structure.  */
   if (current == NULL)
     {
-      current = (struct catalog *) xmalloc (sizeof (*current));
-
-      current->all_sets = NULL;
-      current->total_messages = 0;
-      current->last_set = 0;
-      current->current_set = find_set (current, NL_SETD);
+      current = (struct catalog *) xcalloc (1, sizeof (*current));
 
 #define obstack_chunk_alloc malloc
 #define obstack_chunk_free free
       obstack_init (&current->mem_pool);
+
+      current->current_set = find_set (current, NL_SETD);
     }
 
   buf = NULL;
@@ -866,10 +863,8 @@ find_set (struct catalog *current, int number)
       result = result->next;
 
   /* Prepare new message set.  */
-  result = (struct set_list *) xmalloc (sizeof (*result));
+  result = (struct set_list *) xcalloc (1, sizeof (*result));
   result->number = number;
-  result->deleted = 0;
-  result->messages = NULL;
   result->next = current->all_sets;
   current->all_sets = result;