1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-05 19:35:52 +03:00
1998-10-30  Ulrich Drepper  <drepper@cygnus.com>

	* catgets/gencat.c: Do a better job in initializing dynamic
	memory [PR libc/844].
This commit is contained in:
Ulrich Drepper
1998-10-30 18:53:29 +00:00
parent 00995ca9ef
commit a3b2008a2d
2 changed files with 11 additions and 10 deletions

View File

@@ -1,3 +1,8 @@
1998-10-30 Ulrich Drepper <drepper@cygnus.com>
* catgets/gencat.c: Do a better job in initializing dynamic
memory [PR libc/844].
1998-10-30 18:11 Ulrich Drepper <drepper@cygnus.com> 1998-10-30 18:11 Ulrich Drepper <drepper@cygnus.com>
* iconv/gconv_conf.c (__gconv_read_conf): Don't define as * iconv/gconv_conf.c (__gconv_read_conf): Don't define as

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -135,6 +135,7 @@ static struct argp argp =
/* Wrapper functions with error checking for standard functions. */ /* Wrapper functions with error checking for standard functions. */
extern void *xmalloc (size_t n); extern void *xmalloc (size_t n);
extern void *xcalloc (size_t n, size_t s);
/* Prototypes for local functions. */ /* Prototypes for local functions. */
static void error_print (void); static void error_print (void);
@@ -275,16 +276,13 @@ read_input_file (struct catalog *current, const char *fname)
/* If we haven't seen anything yet, allocate result structure. */ /* If we haven't seen anything yet, allocate result structure. */
if (current == NULL) if (current == NULL)
{ {
current = (struct catalog *) xmalloc (sizeof (*current)); current = (struct catalog *) xcalloc (1, sizeof (*current));
current->all_sets = NULL;
current->total_messages = 0;
current->last_set = 0;
current->current_set = find_set (current, NL_SETD);
#define obstack_chunk_alloc malloc #define obstack_chunk_alloc malloc
#define obstack_chunk_free free #define obstack_chunk_free free
obstack_init (&current->mem_pool); obstack_init (&current->mem_pool);
current->current_set = find_set (current, NL_SETD);
} }
buf = NULL; buf = NULL;
@@ -879,10 +877,8 @@ find_set (struct catalog *current, int number)
result = result->next; result = result->next;
/* Prepare new message set. */ /* Prepare new message set. */
result = (struct set_list *) xmalloc (sizeof (*result)); result = (struct set_list *) xcalloc (1, sizeof (*result));
result->number = number; result->number = number;
result->deleted = 0;
result->messages = NULL;
result->next = current->all_sets; result->next = current->all_sets;
current->all_sets = result; current->all_sets = result;