about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-03-17 05:33:30 +0000
committerUlrich Drepper <drepper@redhat.com>2000-03-17 05:33:30 +0000
commit0db0e1497774e4eb55aad4f8accae78bdc2c1273 (patch)
treebf1348bbb3649a9cc90735f91308841836214197
parent19cf43bed69d9952c39391f42f22114afb3a0d3f (diff)
downloadglibc-0db0e1497774e4eb55aad4f8accae78bdc2c1273.tar.gz
glibc-0db0e1497774e4eb55aad4f8accae78bdc2c1273.tar.xz
glibc-0db0e1497774e4eb55aad4f8accae78bdc2c1273.zip
Update.
	* locale/lc-time.c (_nl_init_era_entries): Correct allocation of
	memory for eras.
	Patch by Shinya Hanataka <hanataka@abyss.rim.or.jp>.
-rw-r--r--ChangeLog4
-rw-r--r--locale/lc-time.c11
2 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a36e3114ff..cf57b2fa1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2000-03-16  Ulrich Drepper  <drepper@redhat.com>
 
+	* locale/lc-time.c (_nl_init_era_entries): Correct allocation of
+	memory for eras.
+	Patch by Shinya Hanataka <hanataka@abyss.rim.or.jp>.
+
 	* elf/Makefile: Add rules to compile and rune constload1 test.
 	* elf/constload1.c: New file.
 	* elf/constload2.c: New file.
diff --git a/locale/lc-time.c b/locale/lc-time.c
index c6bf4b10e0..257e211093 100644
--- a/locale/lc-time.c
+++ b/locale/lc-time.c
@@ -1,5 +1,5 @@
 /* Define current locale data for LC_TIME category.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -78,8 +78,9 @@ _nl_init_era_entries (void)
       else
 	{
 	  if (num_eras != new_num_eras)
-	    eras = realloc (eras,
-			    new_num_eras * sizeof (struct era_entry *));
+	    eras = (struct era_entry *) realloc (eras,
+						 new_num_eras
+						 * sizeof (struct era_entry));
 	  if (eras == NULL)
 	    {
 	      num_eras = 0;
@@ -93,8 +94,8 @@ _nl_init_era_entries (void)
 	      for (cnt = 0; cnt < num_eras; ++cnt)
 		{
 		  const char *base_ptr = ptr;
-		  memcpy((void*)(eras + cnt), (const void *) ptr,
-			 sizeof (uint32_t) * 8);
+		  memcpy ((void *) (eras + cnt), (const void *) ptr,
+			  sizeof (uint32_t) * 8);
 
 		  if (ERA_DATE_CMP(eras[cnt].start_date,
 				   eras[cnt].stop_date))