iliaa           Sun Sep 29 18:16:29 2002 EDT

  Modified files:              
    /php4/main  main.c 
  Log:
  Fixed a mem leak inside the path resolving code.
  
  
Index: php4/main/main.c
diff -u php4/main/main.c:1.493 php4/main/main.c:1.494
--- php4/main/main.c:1.493      Sun Sep 29 15:22:39 2002
+++ php4/main/main.c    Sun Sep 29 18:16:29 2002
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.493 2002/09/29 19:22:39 sniper Exp $ */
+/* $Id: main.c,v 1.494 2002/09/29 22:16:29 iliaa Exp $ */
 
 /* {{{ includes
  */
@@ -1512,9 +1512,11 @@
                        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);
-                               primary_file->opened_path = emalloc(realfile_len+1);
-                               memcpy(primary_file->opened_path, realfile, 
realfile_len);
-                               primary_file->opened_path[realfile_len] = '\0';
+                               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';
+                               }       
                        }
                }
 



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

Reply via email to