@@ -629,7 +629,13 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{
629
629
memcmp (path , (* bucket )-> path , path_len ) == 0 ) {
630
630
realpath_cache_bucket * r = * bucket ;
631
631
* bucket = (* bucket )-> next ;
632
- CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 + r -> realpath_len + 1 ;
632
+
633
+ /* if the pointers match then only subtract the length of the path */
634
+ if (r -> path == r -> realpath )
635
+ CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 ;
636
+ else
637
+ CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 + r -> realpath_len + 1 ;
638
+
633
639
free (r );
634
640
return ;
635
641
} else {
@@ -704,7 +710,13 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
704
710
if (CWDG (realpath_cache_ttl ) && (* bucket )-> expires < t ) {
705
711
realpath_cache_bucket * r = * bucket ;
706
712
* bucket = (* bucket )-> next ;
707
- CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 + r -> realpath_len + 1 ;
713
+
714
+ /* if the pointers match then only subtract the length of the path */
715
+ if (r -> path == r -> realpath )
716
+ CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 ;
717
+ else
718
+ CWDG (realpath_cache_size ) -= sizeof (realpath_cache_bucket ) + r -> path_len + 1 + r -> realpath_len + 1 ;
719
+
708
720
free (r );
709
721
} else if (key == (* bucket )-> key && path_len == (* bucket )-> path_len &&
710
722
memcmp (path , (* bucket )-> path , path_len ) == 0 ) {
0 commit comments