wininet: Don't call libcrypto function after closing the library.

Hans Leidekker hans at codeweavers.com
Mon Feb 8 02:20:58 CST 2010


Spotted by Paul Vriens.
---
 dlls/wininet/netconnection.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c
index 0e7b62a..c2560b5 100644
--- a/dlls/wininet/netconnection.c
+++ b/dlls/wininet/netconnection.c
@@ -160,6 +160,7 @@ MAKE_FUNCPTR(sk_value);
 #undef MAKE_FUNCPTR
 
 static CRITICAL_SECTION *ssl_locks;
+static unsigned int num_ssl_locks;
 
 static unsigned long ssl_thread_id(void)
 {
@@ -458,14 +459,14 @@ DWORD NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
         pSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, netconn_secure_verify);
 
         pCRYPTO_set_id_callback(ssl_thread_id);
-        ssl_locks = HeapAlloc(GetProcessHeap(), 0,
-                pCRYPTO_num_locks() * sizeof(CRITICAL_SECTION));
+        num_ssl_locks = pCRYPTO_num_locks();
+        ssl_locks = HeapAlloc(GetProcessHeap(), 0, num_ssl_locks * sizeof(CRITICAL_SECTION));
         if (!ssl_locks)
         {
             LeaveCriticalSection(&init_ssl_cs);
             return ERROR_OUTOFMEMORY;
         }
-        for (i = 0; i < pCRYPTO_num_locks(); i++)
+        for (i = 0; i < num_ssl_locks; i++)
             InitializeCriticalSection(&ssl_locks[i]);
         pCRYPTO_set_locking_callback(ssl_lock_callback);
         LeaveCriticalSection(&init_ssl_cs);
@@ -494,7 +495,7 @@ void NETCON_unload(void)
     if (ssl_locks)
     {
         int i;
-        for (i = 0; i < pCRYPTO_num_locks(); i++) DeleteCriticalSection(&ssl_locks[i]);
+        for (i = 0; i < num_ssl_locks; i++) DeleteCriticalSection(&ssl_locks[i]);
         HeapFree(GetProcessHeap(), 0, ssl_locks);
     }
 #endif
-- 
1.6.3.3





More information about the wine-patches mailing list