summaryrefslogtreecommitdiff
path: root/third_party/base/allocator/partition_allocator/partition_alloc.cc
diff options
context:
space:
mode:
authorChris Palmer <palmer@chromium.org>2017-04-11 16:51:43 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-12 17:28:27 +0000
commit661fcc0156b78fd40937c0844034605f430b94c6 (patch)
tree2f66aee0d27d78a5b2002805b1938d1ffd7e681b /third_party/base/allocator/partition_allocator/partition_alloc.cc
parent9d6a2089c93c94461289b21a29771039eace95e7 (diff)
downloadpdfium-661fcc0156b78fd40937c0844034605f430b94c6.tar.xz
Pull in the latest PartitionAlloc fixes from upstream.
BUG=pdfium:691 Change-Id: If6f1e200e763827ec640b2b79171f3899ea7927e Reviewed-on: https://pdfium-review.googlesource.com/4050 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Chris Palmer <palmer@chromium.org>
Diffstat (limited to 'third_party/base/allocator/partition_allocator/partition_alloc.cc')
-rw-r--r--third_party/base/allocator/partition_allocator/partition_alloc.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/third_party/base/allocator/partition_allocator/partition_alloc.cc b/third_party/base/allocator/partition_allocator/partition_alloc.cc
index 9523e78d46..a33d7f1d13 100644
--- a/third_party/base/allocator/partition_allocator/partition_alloc.cc
+++ b/third_party/base/allocator/partition_allocator/partition_alloc.cc
@@ -1061,8 +1061,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;
}