]> granicus.if.org Git - php/commitdiff
Fixed memory leaks on error
authorIlia Alshanetsky <iliaa@php.net>
Sun, 7 Jan 2007 03:12:14 +0000 (03:12 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 7 Jan 2007 03:12:14 +0000 (03:12 +0000)
ext/zip/php_zip.c

index 21291c01333c3ba48775b171a997f453987d09af..4f63d74d53deda2aa7a72648136a79fb4790eccb 100644 (file)
@@ -689,6 +689,7 @@ static PHP_FUNCTION(zip_read)
                        rsrc_int->index_current++;
                        ZEND_REGISTER_RESOURCE(return_value, zr_rsrc, le_zip_entry);
                } else {
+                       efree(zr_rsrc);
                        RETURN_FALSE;
                }
 
@@ -770,6 +771,7 @@ static PHP_FUNCTION(zip_entry_read)
                        buffer[n] = 0;
                        RETURN_STRINGL(buffer, n, 0);
                } else {
+                       efree(buffer);
                        RETURN_EMPTY_STRING()
                }
        } else {
@@ -1815,6 +1817,7 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
        buffer = safe_emalloc(len, 1, 2);
        n = zip_fread(zf, buffer, len);
        if (n < 1) {
+               efree(buffer);
                RETURN_EMPTY_STRING();
        }