Paul Vriens : ntdll/tests: Free library after use.

Alexandre Julliard julliard at winehq.org
Mon May 19 09:39:57 CDT 2008


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

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Mon May 19 14:00:10 2008 +0200

ntdll/tests: Free library after use.

---

 dlls/ntdll/tests/port.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/dlls/ntdll/tests/port.c b/dlls/ntdll/tests/port.c
index 9715917..a4d3348 100644
--- a/dlls/ntdll/tests/port.c
+++ b/dlls/ntdll/tests/port.c
@@ -118,26 +118,27 @@ static BOOL init_function_ptrs(void)
 {
     hntdll = LoadLibraryA("ntdll.dll");
 
-    if (hntdll)
-    {
-        pNtCompleteConnectPort = (void *)GetProcAddress(hntdll, "NtCompleteConnectPort");
-        pNtAcceptConnectPort = (void *)GetProcAddress(hntdll, "NtAcceptConnectPort");
-        pNtReplyPort = (void *)GetProcAddress(hntdll, "NtReplyPort");
-        pNtReplyWaitReceivePort = (void *)GetProcAddress(hntdll, "NtReplyWaitReceivePort");
-        pNtCreatePort = (void *)GetProcAddress(hntdll, "NtCreatePort");
-        pNtRequestWaitReplyPort = (void *)GetProcAddress(hntdll, "NtRequestWaitReplyPort");
-        pNtRequestPort = (void *)GetProcAddress(hntdll, "NtRequestPort");
-        pNtRegisterThreadTerminatePort = (void *)GetProcAddress(hntdll, "NtRegisterThreadTerminatePort");
-        pNtConnectPort = (void *)GetProcAddress(hntdll, "NtConnectPort");
-        pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
-        pNtWaitForSingleObject = (void *)GetProcAddress(hntdll, "NtWaitForSingleObject");
-    }
+    if (!hntdll)
+        return FALSE;
+
+    pNtCompleteConnectPort = (void *)GetProcAddress(hntdll, "NtCompleteConnectPort");
+    pNtAcceptConnectPort = (void *)GetProcAddress(hntdll, "NtAcceptConnectPort");
+    pNtReplyPort = (void *)GetProcAddress(hntdll, "NtReplyPort");
+    pNtReplyWaitReceivePort = (void *)GetProcAddress(hntdll, "NtReplyWaitReceivePort");
+    pNtCreatePort = (void *)GetProcAddress(hntdll, "NtCreatePort");
+    pNtRequestWaitReplyPort = (void *)GetProcAddress(hntdll, "NtRequestWaitReplyPort");
+    pNtRequestPort = (void *)GetProcAddress(hntdll, "NtRequestPort");
+    pNtRegisterThreadTerminatePort = (void *)GetProcAddress(hntdll, "NtRegisterThreadTerminatePort");
+    pNtConnectPort = (void *)GetProcAddress(hntdll, "NtConnectPort");
+    pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
+    pNtWaitForSingleObject = (void *)GetProcAddress(hntdll, "NtWaitForSingleObject");
 
     if (!pNtCompleteConnectPort || !pNtAcceptConnectPort ||
         !pNtReplyWaitReceivePort || !pNtCreatePort || !pNtRequestWaitReplyPort ||
         !pNtRequestPort || !pNtRegisterThreadTerminatePort ||
         !pNtConnectPort || !pRtlInitUnicodeString)
     {
+        FreeLibrary(hntdll);
         return FALSE;
     }
 
@@ -309,4 +310,6 @@ START_TEST(port)
 
     test_ports_server();
     CloseHandle(thread);
+
+    FreeLibrary(hntdll);
 }




More information about the wine-cvs mailing list