]> granicus.if.org Git - php/commitdiff
Fixed a mem leak inside the path resolving code.
authorIlia Alshanetsky <iliaa@php.net>
Sun, 29 Sep 2002 22:16:29 +0000 (22:16 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 29 Sep 2002 22:16:29 +0000 (22:16 +0000)
main/main.c

index ea411e4b94d5c2ffbcd104d2db1ea12729a255c8..b259955ee4102d3ee057b43f06bdf1edfc881b8c 100644 (file)
@@ -1512,9 +1512,11 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
                        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';
+                               }       
                        }
                }