]> granicus.if.org Git - php/commitdiff
- Fix a few more memleaks found by parfait
authorJohannes Schlüter <johannes@php.net>
Mon, 16 May 2011 21:29:45 +0000 (21:29 +0000)
committerJohannes Schlüter <johannes@php.net>
Mon, 16 May 2011 21:29:45 +0000 (21:29 +0000)
ext/date/lib/parse_tz.c

index 99ef7a88c07049f1a3ed2b7510050e3aae1ddf3f..b8d8448c9407f102433da6c59c4d0203c42d2660 100644 (file)
@@ -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++) {