diff -r 5f4402180204 -r e3974e7360e9 src/Platform-Posix.cpp --- a/src/Platform-Posix.cpp Wed Jul 25 00:48:08 2012 -0700 +++ b/src/Platform-Posix.cpp Wed Jul 25 01:30:33 2012 -0700 @@ -72,7 +72,7 @@ } size_t requested = Min(amount * 2, amount + 2 * alignment); - Address address = MapMemory(amount, mode, Prot_ReadWrite); + Address address = MapMemory(requested, mode, Prot_ReadWrite); if (!address) return AlignableMapping(); @@ -87,7 +87,7 @@ if (requested - begin > amount) { // Shave off the last part of the unaligned region. - UnmapAlignedMemory(address + amount, requested - amount - begin); + UnmapAlignedMemory(aligned + amount, requested - amount - begin); } return AlignableMapping(aligned, alignment, amount);