felipe                                   Tue, 22 Nov 2011 15:12:44 +0000

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

Log:
- Fix the fix

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/apprentice.c
    U   php/php-src/branches/PHP_5_4/ext/fileinfo/libmagic/apprentice.c
    U   php/php-src/trunk/ext/fileinfo/libmagic/apprentice.c

Modified: php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/apprentice.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/apprentice.c     
2011-11-22 15:04:19 UTC (rev 319683)
+++ php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/apprentice.c     
2011-11-22 15:12:44 UTC (rev 319684)
@@ -2070,11 +2070,11 @@
        }

        mm = emalloc((size_t)st.sb.st_size);
+       ret = 1;
        if (php_stream_read(stream, mm, (size_t)st.sb.st_size) != 
(size_t)st.sb.st_size) {
                file_badread(ms);
                goto error1;
        }
-       ret = 1;

        php_stream_close(stream);
        stream = NULL;
@@ -2137,7 +2137,7 @@
                php_stream_close(stream);
        }

-       if (mm) {
+       if (mm && ret == 1) {
                efree(mm);
        } else {
                *magicp = NULL;

Modified: php/php-src/branches/PHP_5_4/ext/fileinfo/libmagic/apprentice.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/fileinfo/libmagic/apprentice.c     
2011-11-22 15:04:19 UTC (rev 319683)
+++ php/php-src/branches/PHP_5_4/ext/fileinfo/libmagic/apprentice.c     
2011-11-22 15:12:44 UTC (rev 319684)
@@ -2070,11 +2070,11 @@
        }

        mm = emalloc((size_t)st.sb.st_size);
+       ret = 1;
        if (php_stream_read(stream, mm, (size_t)st.sb.st_size) != 
(size_t)st.sb.st_size) {
                file_badread(ms);
                goto error1;
        }
-       ret = 1;

        php_stream_close(stream);
        stream = NULL;
@@ -2137,7 +2137,7 @@
                php_stream_close(stream);
        }

-       if (mm) {
+       if (mm && ret == 1) {
                efree(mm);
        } else {
                *magicp = NULL;

Modified: php/php-src/trunk/ext/fileinfo/libmagic/apprentice.c
===================================================================
--- php/php-src/trunk/ext/fileinfo/libmagic/apprentice.c        2011-11-22 
15:04:19 UTC (rev 319683)
+++ php/php-src/trunk/ext/fileinfo/libmagic/apprentice.c        2011-11-22 
15:12:44 UTC (rev 319684)
@@ -2070,11 +2070,11 @@
        }

        mm = emalloc((size_t)st.sb.st_size);
+       ret = 1;
        if (php_stream_read(stream, mm, (size_t)st.sb.st_size) != 
(size_t)st.sb.st_size) {
                file_badread(ms);
                goto error1;
        }
-       ret = 1;

        php_stream_close(stream);
        stream = NULL;
@@ -2137,7 +2137,7 @@
                php_stream_close(stream);
        }

-       if (mm) {
+       if (mm && ret == 1) {
                efree(mm);
        } else {
                *magicp = NULL;

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

Reply via email to