X86PagingStructuresPAE: Zero fPageDirPointerTable in constructor

... and use it as a guard in the destructor. Fixes crash when running
out of memory and Init() is not called.
This commit is contained in:
Ingo Weinhold 2013-09-18 16:12:51 +02:00
parent 7d09a8dc67
commit 9a85313bc6

View File

@ -20,6 +20,8 @@
X86PagingStructuresPAE::X86PagingStructuresPAE()
:
fPageDirPointerTable(NULL)
{
memset(fVirtualPageDirs, 0, sizeof(fVirtualPageDirs));
}
@ -32,8 +34,10 @@ X86PagingStructuresPAE::~X86PagingStructuresPAE()
// There's one contiguous allocation for 0 and 1.
// free the PDPT page
X86PagingMethodPAE::Method()->Free32BitPage(fPageDirPointerTable,
pgdir_phys, fPageDirPointerTableHandle);
if (fPageDirPointerTable != NULL) {
X86PagingMethodPAE::Method()->Free32BitPage(fPageDirPointerTable,
pgdir_phys, fPageDirPointerTableHandle);
}
}