pajoye                                   Wed, 27 Jan 2010 14:41:06 +0000

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

Log:
- fix leak when the SID is already used and duplicated

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

Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c
===================================================================
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c      2010-01-27 14:38:35 UTC 
(rev 294093)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c      2010-01-27 14:41:06 UTC 
(rev 294094)
@@ -170,6 +170,7 @@

        /* ConvertSidToStringSid(pTokenUser->User.Sid, &ptcSidOwner); */
        pResultSid = malloc(sid_len);
+
        if (!pResultSid) {
                goto Finished;
        }
@@ -271,6 +272,9 @@
                        if (!DuplicateToken(thread_token, 
SecurityImpersonation, &TWG(impersonation_token))) {
                                goto Finished;
                        }
+               } else {
+                       /* we already have it, free it then */
+                       free(token_sid);
                }

                if (CWDG(realpath_cache_size_limit)) {

Modified: php/php-src/trunk/TSRM/tsrm_win32.c
===================================================================
--- php/php-src/trunk/TSRM/tsrm_win32.c 2010-01-27 14:38:35 UTC (rev 294093)
+++ php/php-src/trunk/TSRM/tsrm_win32.c 2010-01-27 14:41:06 UTC (rev 294094)
@@ -271,6 +271,9 @@
                        if (!DuplicateToken(thread_token, 
SecurityImpersonation, &TWG(impersonation_token))) {
                                goto Finished;
                        }
+               } else {
+                       /* we already have it, free it then */
+                       free(token_sid);
                }

                if (CWDG(realpath_cache_size_limit)) {

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

Reply via email to