Author: jmorlan
Date: Thu Jul 23 22:48:43 2009
New Revision: 42163
URL:
http://svn.reactos.org/svn/reactos?rev=42163&view=rev
Log:
LoadLibraryExW: After loading a library as a datafile, clean up properly (don't leak
SearchPath, and don't free DllName if we didn't allocate it)
Modified:
trunk/reactos/dll/win32/kernel32/misc/ldr.c
Modified: trunk/reactos/dll/win32/kernel32/misc/ldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/ld…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/ldr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/ldr.c [iso-8859-1] Thu Jul 23 22:48:43 2009
@@ -266,14 +266,7 @@
* 'native' libraries only
*/
Status = LoadLibraryAsDatafile(SearchPath, DllName.Buffer, &hInst);
- RtlFreeUnicodeString(&DllName);
- if (!NT_SUCCESS(Status))
- {
- SetLastErrorByStatus(Status);
- return NULL;
- }
-
- return hInst;
+ goto done;
}
}
@@ -292,6 +285,7 @@
Status = LdrLoadDll(SearchPath, &dwFlags, &DllName, (PVOID*)&hInst);
}
+done:
RtlFreeHeap(RtlGetProcessHeap(), 0, SearchPath);
if (FreeString)
RtlFreeUnicodeString(&DllName);