1
0
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:
Paul Eggert
2014-08-26 12:48:16 -07:00
parent 636f5e942c
commit 3230f367b0

View File

@ -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