From 546961a9897bbe76c6c154e4fcb9d8bfe3dc2a2b Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 31 Jan 2011 08:34:45 +0100 Subject: [PATCH] charset.c (load_charset_map): Don't deref NULL on failed malloc. --- src/ChangeLog | 5 +++++ src/charset.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 393223c0802..63ea7c29bf4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-01-31 Jim Meyering + + * charset.c (load_charset_map): Don't deref NULL on failed malloc. + Use xmalloc rather than malloc. + 2011-01-30 Paul Eggert strftime: import from gnulib diff --git a/src/charset.c b/src/charset.c index 57e24ae0c31..a6046600194 100644 --- a/src/charset.c +++ b/src/charset.c @@ -292,7 +292,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries, else { if (! temp_charset_work) - temp_charset_work = malloc (sizeof (*temp_charset_work)); + temp_charset_work = xmalloc (sizeof (*temp_charset_work)); if (control_flag == 1) { memset (temp_charset_work->table.decoder, -1, -- 2.39.5