mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2025-11-22 16:24:14 +00:00
* localtime.c (zoneinit, tzalloc): Return NULL on failure.
Suggested by Jonathan Lennox in: http://mm.icann.org/pipermail/tz/2014-August/021529.html
This commit is contained in:
@ -1191,7 +1191,7 @@ zoneinit(struct state *sp, char const *name)
|
||||
strcpy(sp->chars, gmt);
|
||||
} else if (! (tzload(name, sp, true)
|
||||
|| (name && name[0] != ':' && tzparse(name, sp, false))))
|
||||
gmtload(sp);
|
||||
return NULL;
|
||||
}
|
||||
return sp;
|
||||
}
|
||||
@ -1264,7 +1264,10 @@ timezone_t
|
||||
tzalloc(char const *name)
|
||||
{
|
||||
timezone_t sp = malloc(sizeof *sp);
|
||||
return zoneinit(sp, name);
|
||||
timezone_t tp = sp ? zoneinit(sp, name) : sp;
|
||||
if (!tp)
|
||||
free(sp);
|
||||
return tp;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user