@@ -617,7 +617,13 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{
617
617
memcmp (path , (* bucket )-> path , path_len ) == 0 ) {
618
618
realpath_cache_bucket * r = * bucket ;
619
619
* bucket = (* bucket )-> next ;
620
- CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 + r -> realpath_len + 1 ;
620
+
621
+ /* if the pointers match then only subtract the length of the path */
622
+ if (r -> path == r -> realpath )
623
+ CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 ;
624
+ else
625
+ CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 + r -> realpath_len + 1 ;
626
+
621
627
free (r );
622
628
return ;
623
629
} else {
@@ -692,7 +698,13 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
692
698
if (CWDG (realpath_cache_ttl ) && (* bucket )-> expires < t ) {
693
699
realpath_cache_bucket * r = * bucket ;
694
700
* bucket = (* bucket )-> next ;
695
- CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 + r -> realpath_len + 1 ;
701
+
702
+ /* if the pointers match then only subtract the length of the path */
703
+ if (r -> path == r -> realpath )
704
+ CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 ;
705
+ else
706
+ CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 + r -> realpath_len + 1 ;
707
+
696
708
free (r );
697
709
} else if (key == (* bucket )-> key && path_len == (* bucket )-> path_len &&
698
710
memcmp (path , (* bucket )-> path , path_len ) == 0 ) {
0 commit comments