mirror of
https://github.com/gperftools/gperftools
synced 2025-01-12 18:01:13 +00:00
actually check result of CheckAddressBits
Previously call to CheckAddressBits was made but nothing was done to it's result. I've also make sure that actual size is used in checks and in bumping up of TCMalloc_SystemTaken.
This commit is contained in:
parent
f216317a87
commit
925bbaea76
@ -495,17 +495,17 @@ void* TCMalloc_SystemAlloc(size_t size, size_t *actual_size,
|
||||
// Enforce minimum alignment
|
||||
if (alignment < sizeof(MemoryAligner)) alignment = sizeof(MemoryAligner);
|
||||
|
||||
size_t actual_size_storage;
|
||||
if (actual_size == NULL) {
|
||||
actual_size = &actual_size_storage;
|
||||
}
|
||||
|
||||
void* result = sys_alloc->Alloc(size, actual_size, alignment);
|
||||
if (result != NULL) {
|
||||
if (actual_size) {
|
||||
CHECK_CONDITION(
|
||||
CheckAddressBits<kAddressBits>(
|
||||
reinterpret_cast<uintptr_t>(result) + *actual_size - 1);
|
||||
TCMalloc_SystemTaken += *actual_size;
|
||||
} else {
|
||||
CheckAddressBits<kAddressBits>(
|
||||
reinterpret_cast<uintptr_t>(result) + size - 1);
|
||||
TCMalloc_SystemTaken += size;
|
||||
}
|
||||
reinterpret_cast<uintptr_t>(result) + *actual_size - 1));
|
||||
TCMalloc_SystemTaken += *actual_size;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user