diff options
author | Simo Sorce <idra@samba.org> | 2001-08-12 17:30:01 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2001-08-12 17:30:01 +0000 |
commit | 2e783a47076bd0994b6ce86df7ec967bc1c2da63 (patch) | |
tree | c6504d6e8396eef290fe499abb8586b758f1f3d4 /source3/lib/time.c | |
parent | ddec8306586414cc02eca612777bb547cb8dbcae (diff) | |
download | samba-2e783a47076bd0994b6ce86df7ec967bc1c2da63.tar.gz samba-2e783a47076bd0994b6ce86df7ec967bc1c2da63.tar.bz2 samba-2e783a47076bd0994b6ce86df7ec967bc1c2da63.zip |
this is a big global fix for the ptr = Realloc(ptr, size) bug.
many possible mem leaks, and segfaults fixed.
someone should port this fix to 2.2 also.
(This used to be commit fa8e55b8b465114ce209344965c1ca0333b84db9)
Diffstat (limited to 'source3/lib/time.c')
-rw-r--r-- | source3/lib/time.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/lib/time.c b/source3/lib/time.c index 9714d4b9f8..12643b0522 100644 --- a/source3/lib/time.c +++ b/source3/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) { + if (!tdt) { + DEBUG(0,("TimeZoneFaster: out of memory!\n")); + if (dst_table) free (dst_table); table_size = 0; } else { + dst_table = tdt; table_size++; dst_table[i].zone = zone; |