From: Dmitry Stogov Date: Mon, 16 Jan 2006 09:12:22 +0000 (+0000) Subject: Fixed bug #36016 (realpath cache memleaks) X-Git-Tag: php-5.1.3RC1~254 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b1791a767099325b27c9e800f243a2132466ce3;p=php Fixed bug #36016 (realpath cache memleaks) --- diff --git a/NEWS b/NEWS index 50dddc5e29..95a8902c89 100644 --- 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 diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 59422a4f9f..ebc490500d 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -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])); diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h index 2b64cf4336..362659bc9d 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/TSRM/tsrm_virtual_cwd.h @@ -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 diff --git a/main/main.c b/main/main.c index 210a32f06d..21c81e93b7 100644 --- a/main/main.c +++ b/main/main.c @@ -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() /* }}} */