On 11/12/06, Nuno Lopes <[EMAIL PROTECTED]> wrote:
nlopess         Sun Nov 12 00:31:37 2006 UTC

  Modified files:
    /php-src/ext/zip    php_zip.c
  Log:
MFB: fix leak in the object destrucotr when zip_close() fails (fixes oo_delete.phpt)

http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.30&r2=1.31&diff_format=u
Index: php-src/ext/zip/php_zip.c
diff -u php-src/ext/zip/php_zip.c:1.30 php-src/ext/zip/php_zip.c:1.31
--- php-src/ext/zip/php_zip.c:1.30      Sat Nov 11 23:43:40 2006
+++ php-src/ext/zip/php_zip.c   Sun Nov 12 00:31:37 2006
@@ -16,7 +16,7 @@

+----------------------------------------------------------------------+
 */

-/* $Id: php_zip.c,v 1.30 2006/11/11 23:43:40 nlopess Exp $ */
+/* $Id: php_zip.c,v 1.31 2006/11/12 00:31:37 nlopess Exp $ */

 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -470,7 +470,9 @@
                return;
        }
        if (intern->za) {
-               zip_close(intern->za);
+               if (zip_close(intern->za) != 0) {
+                       _zip_free(intern->za);
+               }

It sounds wrong. _zip_free is a private function and is used in
zip_close. Can you do it there instead?

itself.oo_delete.phpt works here, which error do you have?

--Pierre

Yes, I also thought that it was a private function, but I really had to use it. The problem arises when zip_close() returns -1 (that was happending with me) and that function doesn't call _zip_free() on error (so that you can retrieve the error), thus creating a memleak.

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

Reply via email to