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)

svn path=/trunk/; revision=42163
This commit is contained in:
Jeffrey Morlan 2009-07-23 20:48:43 +00:00
parent c3f828c7ee
commit 91de7b5fd3

View file

@ -266,14 +266,7 @@ LoadLibraryExW (
* '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 @@ LoadLibraryExW (
Status = LdrLoadDll(SearchPath, &dwFlags, &DllName, (PVOID*)&hInst);
}
done:
RtlFreeHeap(RtlGetProcessHeap(), 0, SearchPath);
if (FreeString)
RtlFreeUnicodeString(&DllName);