summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2011-05-19 23:09:58 +0000
committerRasmus Lerdorf <rasmus@php.net>2011-05-19 23:09:58 +0000
commite40c470c9d6c2bf201d1b2f6571a82bcc8d90ec4 (patch)
tree459bf4881e3579b3b87ce6c01c18583826e7ffda /TSRM
parent221a07b669ced5fd65f833ecc69df166d617c419 (diff)
downloadphp-git-e40c470c9d6c2bf201d1b2f6571a82bcc8d90ec4.tar.gz
Fix bug 54866
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/tsrm_virtual_cwd.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c
index 6fdf9eb994..b3d12e2b95 100644
--- a/TSRM/tsrm_virtual_cwd.c
+++ b/TSRM/tsrm_virtual_cwd.c
@@ -629,7 +629,13 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{
memcmp(path, (*bucket)->path, path_len) == 0) {
realpath_cache_bucket *r = *bucket;
*bucket = (*bucket)->next;
- CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
+
+ /* if the pointers match then only subtract the length of the path */
+ if(r->path == r->realpath)
+ CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1;
+ else
+ CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
+
free(r);
return;
} else {
@@ -704,7 +710,13 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
if (CWDG(realpath_cache_ttl) && (*bucket)->expires < t) {
realpath_cache_bucket *r = *bucket;
*bucket = (*bucket)->next;
- CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
+
+ /* if the pointers match then only subtract the length of the path */
+ if(r->path == r->realpath)
+ CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1;
+ else
+ CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
+
free(r);
} else if (key == (*bucket)->key && path_len == (*bucket)->path_len &&
memcmp(path, (*bucket)->path, path_len) == 0) {