From b37f2257a4058cd38d825ad2eb9e6b5dd483281d Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 27 Jan 2010 16:43:16 +0000 Subject: [PATCH] - fix leak, win only --- TSRM/tsrm_virtual_cwd.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index e8d6355bed..a076ea99d9 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -432,8 +432,8 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) /* {{{ */ static inline unsigned long realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */ { register unsigned long h; - char *bucket_key = tsrm_win32_get_path_sid_key(path TSRMLS_CC); - char *bucket_key_start = (char *)bucket_key; + char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC); + char *bucket_key = (char *)bucket_key_start; const char *e = bucket_key + strlen(bucket_key); if (!bucket_key) { @@ -444,11 +444,7 @@ static inline unsigned long realpath_cache_key(const char *path, int path_len TS h *= 16777619; h ^= *bucket_key++; } - /* if no SID were present the path is returned. Otherwise a Heap - allocated string is returned. */ - if (bucket_key_start != path) { - LocalFree(bucket_key_start); - } + HeapFree(GetProcessHeap(), 0, (LPVOID)bucket_key_start); return h; } /* }}} */ -- 2.40.0