lbarnaud                Thu Sep 11 15:45:29 2008 UTC

  Modified files:              
    /php-src/ext/spl    spl_directory.c 
  Log:
  Fix invalid free
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.166&r2=1.167&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.166 
php-src/ext/spl/spl_directory.c:1.167
--- php-src/ext/spl/spl_directory.c:1.166       Thu Sep 11 15:31:48 2008
+++ php-src/ext/spl/spl_directory.c     Thu Sep 11 15:45:29 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_directory.c,v 1.166 2008/09/11 15:31:48 lbarnaud Exp $ */
+/* $Id: spl_directory.c,v 1.167 2008/09/11 15:45:29 lbarnaud Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1163,6 +1163,7 @@
        UChar *path;
        int filename_len, path_len;
        char *filename, buff[MAXPATHLEN];
+       zend_bool free_filename = 0;
 
        zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, NULL 
TSRMLS_CC);
 
@@ -1175,6 +1176,7 @@
        } else {
                if (intern->file_name_type == IS_UNICODE) {
                        php_stream_path_encode(NULL, &filename, &filename_len, 
intern->file_name.u, intern->file_name_len, REPORT_ERRORS, FG(default_context));
+                       free_filename = filename != NULL;
                } else {
                        filename = intern->file_name.s;
                }
@@ -1199,7 +1201,7 @@
                RETVAL_FALSE;
        }
 
-       if (intern->file_name_type == IS_UNICODE && filename) {
+       if (free_filename) {
                efree(filename);
        }
 }



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

Reply via email to