]> granicus.if.org Git - php/commitdiff
Fixed bug #36016 (realpath cache memleaks)
authorDmitry Stogov <dmitry@php.net>
Mon, 16 Jan 2006 09:12:22 +0000 (09:12 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 16 Jan 2006 09:12:22 +0000 (09:12 +0000)
NEWS
TSRM/tsrm_virtual_cwd.c
TSRM/tsrm_virtual_cwd.h
main/main.c

diff --git a/NEWS b/NEWS
index 50dddc5e29cd72a3ca34be5252efb48166b838d0..95a8902c89c0769412f9ae0704e6845c2d1be5df 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ PHP                                                                        NEWS
 - Added "consumed" stream filter. (Marcus)
 - Added new mysqli constants for BIT and NEW_DECIMAL field types:
   MYSQLI_TYPE_NEWDECIMAL and MYSQLI_TYPE_BIT. FR #36007. (Georg)
+- Fixed bug #36016 (realpath cache memleaks). (Dmitry, Nuno)
 - Fixed bug #36011 (Strict errormsg wrong for call_user_func() and the likes).
   (Marcus)
 - Fixed bug #35998 (SplFileInfo::getPathname() returns unix style filenames
index 59422a4f9fb7cb36a568f684a9af1efa728aacf4..ebc490500d3acc130ce9417c53ec0e34f2bb56f4 100644 (file)
@@ -338,8 +338,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
        }
 }
 
-//static inline 
-realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t TSRMLS_DC)
+static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t TSRMLS_DC)
 {
        unsigned long key = realpath_cache_key(path, path_len);
        unsigned long n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
index 2b64cf4336eaeffcd3ffbfec78c5e8d76614db39..362659bc9d74816ba7be19cf773d144f12c3c2c4 100644 (file)
@@ -195,11 +195,9 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_
 
 CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath);
 
-#define REALPATH_CACHE
 #define REALPATH_CACHE_TTL  (2*60) /* 2 minutes */
 #define REALPATH_CACHE_SIZE 0      /* disabled while php.ini isn't loaded */
 
-#ifdef REALPATH_CACHE
 typedef struct _realpath_cache_bucket {
        unsigned long                  key;
        char                          *path;
@@ -209,16 +207,13 @@ typedef struct _realpath_cache_bucket {
        time_t                         expires;
        struct _realpath_cache_bucket *next;    
 } realpath_cache_bucket;
-#endif
 
 typedef struct _virtual_cwd_globals {
        cwd_state cwd;
-#ifdef REALPATH_CACHE
        long                   realpath_cache_size;
        long                   realpath_cache_size_limit;
        long                   realpath_cache_ttl;
        realpath_cache_bucket *realpath_cache[1024];
-#endif
 } virtual_cwd_globals;
 
 #ifdef ZTS
index 210a32f06d1972130a5cd7bc18e840bcb2d6d635..21c81e93b7f81c02f1339b51a7fdb1fe4550a633 100644 (file)
@@ -322,10 +322,8 @@ PHP_INI_BEGIN()
 
        STD_PHP_INI_BOOLEAN("allow_url_fopen",          "1",            PHP_INI_SYSTEM,         OnUpdateBool,                   allow_url_fopen,                        php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("always_populate_raw_post_data",            "0",            PHP_INI_SYSTEM|PHP_INI_PERDIR,          OnUpdateBool,                   always_populate_raw_post_data,                  php_core_globals,       core_globals)
-#ifdef REALPATH_CACHE
        STD_PHP_INI_ENTRY("realpath_cache_size", "16K", PHP_INI_SYSTEM, OnUpdateLong, realpath_cache_size_limit, virtual_cwd_globals, cwd_globals)
        STD_PHP_INI_ENTRY("realpath_cache_ttl", "120", PHP_INI_SYSTEM, OnUpdateLong, realpath_cache_ttl, virtual_cwd_globals, cwd_globals)
-#endif
 PHP_INI_END()
 /* }}} */