From 994576bc0f3e7f33fece1fc8f20fd85ae1419b21 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 16 Oct 2018 20:24:19 +0000 Subject: Use PartitionAllocZeroFill in CFX_V8ArrayBufferAllocator::Allocate(). Avoid a manual memset(). BUG=pdfium:1171 Change-Id: Ib624906c6852966bce90b8c877ce45079bc6810e Reviewed-on: https://pdfium-review.googlesource.com/c/44074 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- fxjs/cfx_v8.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fxjs/cfx_v8.cpp b/fxjs/cfx_v8.cpp index 26c9a43988..4d12e3353e 100644 --- a/fxjs/cfx_v8.cpp +++ b/fxjs/cfx_v8.cpp @@ -206,10 +206,8 @@ v8::Local CFX_V8::ToArray(v8::Local pValue) { void* CFX_V8ArrayBufferAllocator::Allocate(size_t length) { if (length > kMaxAllowedBytes) return nullptr; - void* p = AllocateUninitialized(length); - if (p) - memset(p, 0, length); - return p; + return gArrayBufferPartitionAllocator.root()->AllocFlags( + pdfium::base::PartitionAllocZeroFill, length, "CFX_V8ArrayBuffer"); } void* CFX_V8ArrayBufferAllocator::AllocateUninitialized(size_t length) { -- cgit v1.2.3