]> granicus.if.org Git - php/commitdiff
- fix leak when the SID is already used and duplicated, windows only
authorPierre Joye <pajoye@php.net>
Thu, 4 Feb 2010 09:25:09 +0000 (09:25 +0000)
committerPierre Joye <pajoye@php.net>
Thu, 4 Feb 2010 09:25:09 +0000 (09:25 +0000)
TSRM/tsrm_win32.c

index 1b9f9d8f3999f96f052c28507a2d9a9d5ffb7620..0b9f2c94965eba13c91759d42452832e33082d4b 100644 (file)
@@ -170,6 +170,7 @@ PSID tsrm_win32_get_token_sid(HANDLE hToken)
 
        /* ConvertSidToStringSid(pTokenUser->User.Sid, &ptcSidOwner); */
        pResultSid = malloc(sid_len);
+
        if (!pResultSid) {
                goto Finished;
        }
@@ -271,6 +272,9 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode)
                        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)) {