summaryrefslogtreecommitdiff
path: root/ext/date/lib/parse_tz.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/date/lib/parse_tz.c')
-rw-r--r--ext/date/lib/parse_tz.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
index 99ef7a88c0..b8d8448c94 100644
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
@@ -100,6 +100,7 @@ static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
cbuffer = (unsigned char*) malloc(tz->timecnt * sizeof(unsigned char));
if (!cbuffer) {
+ free(buffer);
return;
}
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->timecnt);
@@ -125,6 +126,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
tz->type = (ttinfo*) malloc(tz->typecnt * sizeof(struct ttinfo));
if (!tz->type) {
+ free(buffer);
return;
}
@@ -153,6 +155,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
tz->leap_times = (tlinfo*) malloc(tz->leapcnt * sizeof(tlinfo));
if (!tz->leap_times) {
+ free(leap_buffer);
return;
}
for (i = 0; i < tz->leapcnt; i++) {