diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-10-30 18:55:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-10-30 18:55:10 +0000 |
commit | eb5a1f61c46ed5a442a22ba847955730dd52f624 (patch) | |
tree | f9c0619df8c9517e27bc4569bcd14f238af3a372 | |
parent | d7d5cd1eaba9443feb139f0e2a7917cb9f162511 (diff) | |
download | glibc-eb5a1f61c46ed5a442a22ba847955730dd52f624.zip glibc-eb5a1f61c46ed5a442a22ba847955730dd52f624.tar.gz glibc-eb5a1f61c46ed5a442a22ba847955730dd52f624.tar.bz2 |
Do a better job in initializing dynamic memory.
-rw-r--r-- | catgets/gencat.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/catgets/gencat.c b/catgets/gencat.c index 20a3e6a..e1396a1 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 (¤t->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; |