Commit fcc2fe18 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Avoid double checking free type flags in NtFreeVirtualMemory.

parent 8611e654
......@@ -1129,20 +1129,14 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, ULONG *siz
return STATUS_SUCCESS;
}
if ((type != MEM_DECOMMIT) && (type != MEM_RELEASE))
{
WARN("called with wrong free type flags (%08lx) !\n", type);
return STATUS_INVALID_PARAMETER;
}
/* Free the pages */
if (type == MEM_RELEASE)
{
/* Free the pages */
if (size || (base != view->base)) return STATUS_INVALID_PARAMETER;
VIRTUAL_DeleteView( view );
}
else
else if (type == MEM_DECOMMIT)
{
/* Decommit the pages by remapping zero-pages instead */
......@@ -1150,6 +1144,11 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, ULONG *siz
ERR( "Could not remap pages, expect trouble\n" );
if (!VIRTUAL_SetProt( view, base, size, 0 )) return STATUS_ACCESS_DENIED; /* FIXME */
}
else
{
WARN("called with wrong free type flags (%08lx) !\n", type);
return STATUS_INVALID_PARAMETER;
}
*addr_ptr = base;
*size_ptr = size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment