iliaa           Wed Oct 16 12:52:09 2002 EDT

  Modified files:              
    /php4/main  main.c 
  Log:
  Fixed bug #19921. (memory leak introduced by me in rev 1.492)
  
  
Index: php4/main/main.c
diff -u php4/main/main.c:1.497 php4/main/main.c:1.498
--- php4/main/main.c:1.497      Fri Oct  4 15:20:13 2002
+++ php4/main/main.c    Wed Oct 16 12:52:08 2002
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.497 2002/10/04 19:20:13 sas Exp $ */
+/* $Id: main.c,v 1.498 2002/10/16 16:52:08 iliaa Exp $ */
 
 /* {{{ includes
  */
@@ -1479,6 +1479,7 @@
        zend_file_handle *prepend_file_p, *append_file_p;
        zend_file_handle prepend_file, append_file;
        char *old_cwd;
+       char *old_primary_file_path = NULL;
        int retval = 0;
 
        EG(exit_status) = 0;
@@ -1509,10 +1510,9 @@
                        if (VCWD_REALPATH(primary_file->filename, realfile)) {
                                realfile_len =  strlen(realfile);
                                zend_hash_add(&EG(included_files), realfile, 
realfile_len+1, (void *)&dummy, sizeof(int), NULL);
-                               if (primary_file->opened_path == NULL && 
strncmp(realfile, primary_file->filename, realfile_len)) {
-                                       primary_file->opened_path = 
emalloc(realfile_len+1);
-                                       memcpy(primary_file->opened_path, realfile, 
realfile_len);
-                                       primary_file->opened_path[realfile_len] = '\0';
+                               if (strncmp(realfile, primary_file->filename, 
+realfile_len)) {
+                                       old_primary_file_path = primary_file->filename;
+                                       primary_file->filename = realfile;
                                }       
                        }
                }
@@ -1540,6 +1540,11 @@
                php_mbstring_set_zend_encoding(TSRMLS_C);
 #endif /* ZEND_MULTIBYTE && HAVE_MBSTRING */
                retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, 
prepend_file_p, primary_file, append_file_p) == SUCCESS);
+               
+               if (old_primary_file_path) {
+                       primary_file->filename = old_primary_file_path;
+               }
+               
        } zend_end_try();
 
        if (old_cwd[0] != '\0') {



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

Reply via email to