summaryrefslogtreecommitdiff
path: root/TSRM/tsrm_win32.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2010-01-27 14:41:06 +0000
committerPierre Joye <pajoye@php.net>2010-01-27 14:41:06 +0000
commit79aa615b55bf95a293cbfc9b33e9ec3e3314fb8d (patch)
tree06c8b5b7ece1250c16c6563c1d6ff42e06fc28a6 /TSRM/tsrm_win32.c
parenteb1dc0babfb7c74aec7aff8b0e9cd423e3f8f61d (diff)
downloadphp-git-79aa615b55bf95a293cbfc9b33e9ec3e3314fb8d.tar.gz
- fix leak when the SID is already used and duplicated
Diffstat (limited to 'TSRM/tsrm_win32.c')
-rw-r--r--TSRM/tsrm_win32.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index 7b2deceb54..67742f0b38 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -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)) {