mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Fix memory leak I introduced in revision 14343 and fix buffer size calculation to save 4 bytes.
svn path=/trunk/; revision=14349
This commit is contained in:
parent
f39737088b
commit
742ddb108f
1 changed files with 6 additions and 5 deletions
|
@ -56,10 +56,10 @@ GetDllLoadPath(LPCWSTR lpModule)
|
|||
Length = (lpModuleEnd - lpModule) + 1;
|
||||
}
|
||||
|
||||
Length += GetCurrentDirectoryW(0, NULL) + 1;
|
||||
Length += GetSystemDirectoryW(NULL, 0) + 1;
|
||||
Length += GetWindowsDirectoryW(NULL, 0) + 1;
|
||||
Length += GetEnvironmentVariableW(L"PATH", NULL, 0) + 1;
|
||||
Length += GetCurrentDirectoryW(0, NULL);
|
||||
Length += GetSystemDirectoryW(NULL, 0);
|
||||
Length += GetWindowsDirectoryW(NULL, 0);
|
||||
Length += GetEnvironmentVariableW(L"PATH", NULL, 0);
|
||||
|
||||
EnvironmentBufferW = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||
Length * sizeof(WCHAR));
|
||||
|
@ -181,8 +181,9 @@ LoadLibraryExW (
|
|||
SearchPath = GetDllLoadPath(
|
||||
dwFlags & LOAD_WITH_ALTERED_SEARCH_PATH ? lpLibFileName : NULL);
|
||||
|
||||
RtlInitUnicodeString (&DllName, (LPWSTR)lpLibFileName);
|
||||
RtlInitUnicodeString(&DllName, (LPWSTR)lpLibFileName);
|
||||
Status = LdrLoadDll(SearchPath, dwFlags, &DllName, (PVOID*)&hInst);
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, SearchPath);
|
||||
if ( !NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus (Status);
|
||||
|
|
Loading…
Reference in a new issue