mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 10:13:56 +00:00
RtlReAllocateHeap() does not allocate memory.
This commit is contained in:
parent
e81dedf1a7
commit
f448b79e79
1 changed files with 9 additions and 2 deletions
|
@ -282,8 +282,15 @@ ULONG WINAPI RtlDosSearchPath_U(LPCWSTR paths, LPCWSTR search, LPCWSTR ext,
|
|||
for (needed = 0, ptr = paths; *ptr != 0 && *ptr++ != ';'; needed++);
|
||||
if (needed + filelen > allocated)
|
||||
{
|
||||
name = (WCHAR*)RtlReAllocateHeap(ntdll_get_process_heap(), 0,
|
||||
name, (needed + filelen) * sizeof(WCHAR));
|
||||
if (!name) name = RtlAllocateHeap(GetProcessHeap(), 0,
|
||||
(needed + filelen) * sizeof(WCHAR));
|
||||
else
|
||||
{
|
||||
WCHAR *newname = RtlReAllocateHeap(GetProcessHeap(), 0, name,
|
||||
(needed + filelen) * sizeof(WCHAR));
|
||||
if (!newname) RtlFreeHeap(GetProcessHeap(), 0, name);
|
||||
name = newname;
|
||||
}
|
||||
if (!name) return 0;
|
||||
allocated = needed + filelen;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue