diff options
author | Jeremy Allison <jra@samba.org> | 2001-08-19 17:46:05 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-08-19 17:46:05 +0000 |
commit | 10a47854ff5d466b3df47352a291ed918423398b (patch) | |
tree | dbf7dd33faac67a33b6fb179513566fc091b7005 /source/lib/time.c | |
parent | 4d693f881502fa7cf3b2649a7a5115f261cb4715 (diff) | |
download | samba-10a47854ff5d466b3df47352a291ed918423398b.tar.gz samba-10a47854ff5d466b3df47352a291ed918423398b.tar.xz samba-10a47854ff5d466b3df47352a291ed918423398b.zip |
Realloc fixes.
Jeremy.
Diffstat (limited to 'source/lib/time.c')
-rw-r--r-- | source/lib/time.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/lib/time.c b/source/lib/time.c index 9714d4b9f8e..67a33c3b750 100644 --- a/source/lib/time.c +++ b/source/lib/time.c @@ -121,7 +121,7 @@ Updated by Paul Eggert <eggert@twinsun.com> ********************************************************************/ static int TimeZoneFaster(time_t t) { - static struct dst_table {time_t start,end; int zone;} *dst_table = NULL; + static struct dst_table {time_t start,end; int zone;} *tdt, *dst_table = NULL; static int table_size = 0; int i; int zone = 0; @@ -141,11 +141,14 @@ static int TimeZoneFaster(time_t t) time_t low,high; zone = TimeZone(t); - dst_table = (struct dst_table *)Realloc(dst_table, + tdt = (struct dst_table *)Realloc(dst_table, sizeof(dst_table[0])*(i+1)); - if (!dst_table) { - table_size = 0; - } else { + if (!tdt) { + DEBUG(0,("TimeZoneFaster: out of memory!\n")); + if (dst_table) + free(dst_table); + table_size = 0; + } else { table_size++; dst_table[i].zone = zone; |