Rob Shearman : wininet: Don' t call DeleteSecurityContext and FreeCredentialsHandle on invalid handles.

Alexandre Julliard julliard at winehq.org
Mon Mar 10 17:05:05 CDT 2008


Module: wine
Branch: master
Commit: 8c6ac00820e93e6bc4570a9526d3a951061ca043
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8c6ac00820e93e6bc4570a9526d3a951061ca043

Author: Rob Shearman <rob at codeweavers.com>
Date:   Mon Mar 10 16:39:40 2008 +0000

wininet: Don't call DeleteSecurityContext and FreeCredentialsHandle on invalid handles.

---

 dlls/wininet/http.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 085cab2..aba4bba 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -1341,8 +1341,10 @@ static void HTTPREQ_CloseConnection(WININETHANDLEHEADER *hdr)
 
     if (lpwhr->pAuthInfo)
     {
-        DeleteSecurityContext(&lpwhr->pAuthInfo->ctx);
-        FreeCredentialsHandle(&lpwhr->pAuthInfo->cred);
+        if (SecIsValidHandle(&lpwhr->pAuthInfo->ctx))
+            DeleteSecurityContext(&lpwhr->pAuthInfo->ctx);
+        if (SecIsValidHandle(&lpwhr->pAuthInfo->cred))
+            FreeCredentialsHandle(&lpwhr->pAuthInfo->cred);
 
         HeapFree(GetProcessHeap(), 0, lpwhr->pAuthInfo->auth_data);
         HeapFree(GetProcessHeap(), 0, lpwhr->pAuthInfo->scheme);
@@ -1351,8 +1353,10 @@ static void HTTPREQ_CloseConnection(WININETHANDLEHEADER *hdr)
     }
     if (lpwhr->pProxyAuthInfo)
     {
-        DeleteSecurityContext(&lpwhr->pProxyAuthInfo->ctx);
-        FreeCredentialsHandle(&lpwhr->pProxyAuthInfo->cred);
+        if (SecIsValidHandle(&lpwhr->pProxyAuthInfo->ctx))
+            DeleteSecurityContext(&lpwhr->pProxyAuthInfo->ctx);
+        if (SecIsValidHandle(&lpwhr->pProxyAuthInfo->cred))
+            FreeCredentialsHandle(&lpwhr->pProxyAuthInfo->cred);
 
         HeapFree(GetProcessHeap(), 0, lpwhr->pProxyAuthInfo->auth_data);
         HeapFree(GetProcessHeap(), 0, lpwhr->pProxyAuthInfo->scheme);




More information about the wine-cvs mailing list