Skip to content
Browse files

Fix bug 54866

  • Loading branch information...
1 parent 221a07b commit e40c470c9d6c2bf201d1b2f6571a82bcc8d90ec4 @rlerdorf rlerdorf committed
Showing with 16 additions and 3 deletions.
  1. +2 −1 NEWS
  2. +14 −2 TSRM/tsrm_virtual_cwd.c
View
3 NEWS
@@ -32,8 +32,9 @@ PHP NEWS
(tomas dot brastavicius at quantum dot lt, Pierrick)
. Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent when using
TMPDIR on Windows). (Pierre)
+ . Fixed bug 54866 (incorrect accounting for realpath_cache_size) (Dustin Ward)
-- cURL
+- cURL:
. Added CURLINFO_REDIRECT_URL support. (Daniel Stenberg, Pierre)
. Added support for CURLOPT_MAX_RECV_SPEED_LARGE and
CURLOPT_MAX_SEND_SPEED_LARGE. FR #51815. (Pierrick)
View
16 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) {

0 comments on commit e40c470

Please sign in to comment.
Something went wrong with that request. Please try again.