From 446243b1d97f0a42f14df1f1179898166c692f61 Mon Sep 17 00:00:00 2001 From: Paul Vriens Date: Mon, 19 May 2008 14:00:10 +0200 Subject: [PATCH] ntdll/tests: Free library after use. --- dlls/ntdll/tests/port.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/dlls/ntdll/tests/port.c b/dlls/ntdll/tests/port.c index 971591737a7..a4d3348a20f 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); }