pajoye                                   Wed, 27 Jan 2010 16:43:16 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=294100

Log:
- fix leak, win only

Changed paths:
    U   php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c
    U   php/php-src/trunk/TSRM/tsrm_virtual_cwd.c

Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c
===================================================================
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c        2010-01-27 
16:14:53 UTC (rev 294099)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c        2010-01-27 
16:43:16 UTC (rev 294100)
@@ -432,8 +432,8 @@
 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 @@
                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;
 }
 /* }}} */

Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c
===================================================================
--- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c   2010-01-27 16:14:53 UTC (rev 
294099)
+++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c   2010-01-27 16:43:16 UTC (rev 
294100)
@@ -432,8 +432,8 @@
 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 @@
                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;
 }
 /* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to