Index: base/process/memory_mac.mm |
diff --git a/base/process/memory_mac.mm b/base/process/memory_mac.mm |
index 6cf1297b26f01f680f4da4917bf175259122a2db..8503bbb809f3bc69497aa958408f07c17d42a3c1 100644 |
--- a/base/process/memory_mac.mm |
+++ b/base/process/memory_mac.mm |
@@ -16,6 +16,7 @@ |
#include "base/lazy_instance.h" |
#include "base/logging.h" |
#include "base/mac/mac_util.h" |
+#include "base/mac/mach_logging.h" |
#include "base/scoped_clear_errno.h" |
#include "third_party/apple_apsl/CFBase.h" |
#include "third_party/apple_apsl/malloc.h" |
@@ -222,10 +223,12 @@ void DeprotectMallocZone(ChromeMallocZone* default_zone, |
reinterpret_cast<vm_region_info_t>(&info), |
&count, |
&unused); |
- CHECK(result == KERN_SUCCESS); |
+ MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_region"; |
- result = mach_port_deallocate(mach_task_self(), unused); |
- CHECK(result == KERN_SUCCESS); |
+ // The kernel always returns a null object for VM_REGION_BASIC_INFO_64, but |
+ // balance it with a deallocate in case this ever changes. See 10.9.2 |
+ // xnu-2422.90.20/osfmk/vm/vm_map.c vm_map_region. |
+ mach_port_deallocate(mach_task_self(), unused); |
// Does the region fully enclose the zone pointers? Possibly unwarranted |
// simplification used: using the size of a full version 8 malloc zone rather |
@@ -248,7 +251,7 @@ void DeprotectMallocZone(ChromeMallocZone* default_zone, |
*reprotection_length, |
false, |
info.protection | VM_PROT_WRITE); |
- CHECK(result == KERN_SUCCESS); |
+ MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_protect"; |
} |
} |
@@ -646,7 +649,7 @@ void EnableTerminationOnOutOfMemory() { |
default_reprotection_length, |
false, |
default_reprotection_value); |
- CHECK(result == KERN_SUCCESS); |
+ MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_protect"; |
} |
if (purgeable_reprotection_start) { |
@@ -655,7 +658,7 @@ void EnableTerminationOnOutOfMemory() { |
purgeable_reprotection_length, |
false, |
purgeable_reprotection_value); |
- CHECK(result == KERN_SUCCESS); |
+ MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_protect"; |
} |
#endif |