Index: base/allocator/partition_allocator/partition_alloc.cc |
diff --git a/base/allocator/partition_allocator/partition_alloc.cc b/base/allocator/partition_allocator/partition_alloc.cc |
index 439ce177d88a5061ce42e50b50b94f8f0a923a1e..b13f36bb530265099b5bb31cbe0918a73450a98a 100644 |
--- a/base/allocator/partition_allocator/partition_alloc.cc |
+++ b/base/allocator/partition_allocator/partition_alloc.cc |
@@ -1051,8 +1051,13 @@ void* PartitionReallocGeneric(PartitionRootGeneric* root, |
// determine it is a win. |
if (actual_new_size == actual_old_size) { |
// Trying to allocate a block of size new_size would give us a block of |
- // the same size as the one we've already got, so no point in doing |
- // anything here. |
+ // the same size as the one we've already got, so re-use the allocation |
+ // after updating statistics (and cookies, if present). |
+ PartitionPageSetRawSize(page, PartitionCookieSizeAdjustAdd(new_size)); |
+#if DCHECK_IS_ON() |
+ // Write a new trailing cookie. |
+ PartitionCookieWriteValue(static_cast<char*>(ptr) + new_size); |
+#endif |
return ptr; |
} |