johannes                                 Mon, 16 May 2011 21:29:45 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=311110

Log:
- Fix a few more memleaks found by parfait

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/date/lib/parse_tz.c
    U   php/php-src/branches/PHP_5_4/ext/date/lib/parse_tz.c
    U   php/php-src/trunk/ext/date/lib/parse_tz.c

Modified: php/php-src/branches/PHP_5_3/ext/date/lib/parse_tz.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/lib/parse_tz.c        2011-05-16 
20:11:00 UTC (rev 311109)
+++ php/php-src/branches/PHP_5_3/ext/date/lib/parse_tz.c        2011-05-16 
21:29:45 UTC (rev 311110)
@@ -100,6 +100,7 @@

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

        tz->type = (ttinfo*) malloc(tz->typecnt * sizeof(struct ttinfo));
        if (!tz->type) {
+               free(buffer);
                return;
        }

@@ -153,6 +155,7 @@

                tz->leap_times = (tlinfo*) malloc(tz->leapcnt * sizeof(tlinfo));
                if (!tz->leap_times) {
+                       free(leap_buffer);
                        return;
                }
                for (i = 0; i < tz->leapcnt; i++) {

Modified: php/php-src/branches/PHP_5_4/ext/date/lib/parse_tz.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/date/lib/parse_tz.c        2011-05-16 
20:11:00 UTC (rev 311109)
+++ php/php-src/branches/PHP_5_4/ext/date/lib/parse_tz.c        2011-05-16 
21:29:45 UTC (rev 311110)
@@ -100,6 +100,7 @@

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

        tz->type = (ttinfo*) malloc(tz->typecnt * sizeof(struct ttinfo));
        if (!tz->type) {
+               free(buffer);
                return;
        }

@@ -153,6 +155,7 @@

                tz->leap_times = (tlinfo*) malloc(tz->leapcnt * sizeof(tlinfo));
                if (!tz->leap_times) {
+                       free(leap_buffer);
                        return;
                }
                for (i = 0; i < tz->leapcnt; i++) {

Modified: php/php-src/trunk/ext/date/lib/parse_tz.c
===================================================================
--- php/php-src/trunk/ext/date/lib/parse_tz.c   2011-05-16 20:11:00 UTC (rev 
311109)
+++ php/php-src/trunk/ext/date/lib/parse_tz.c   2011-05-16 21:29:45 UTC (rev 
311110)
@@ -100,6 +100,7 @@

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

        tz->type = (ttinfo*) malloc(tz->typecnt * sizeof(struct ttinfo));
        if (!tz->type) {
+               free(buffer);
                return;
        }

@@ -153,6 +155,7 @@

                tz->leap_times = (tlinfo*) malloc(tz->leapcnt * sizeof(tlinfo));
                if (!tz->leap_times) {
+                       free(leap_buffer);
                        return;
                }
                for (i = 0; i < tz->leapcnt; i++) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to