diff options
author | weili <weili@chromium.org> | 2016-08-19 14:09:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-19 14:09:33 -0700 |
commit | ad589d7b83768f3b78ae6b9c90aa418611cc12c2 (patch) | |
tree | fe7d05842dfb43e738506b2f436eb0a27da73276 /fxjs/cfxjse_runtimedata.cpp | |
parent | 5b13e1dc5770b73295f0c4a61c699a10eb7922e6 (diff) | |
download | pdfium-ad589d7b83768f3b78ae6b9c90aa418611cc12c2.tar.xz |
Fix leaked array buffer allocators of isolates
The array buffer allocators are allocated and owned by pdfium code,
they should be deleted properly after the corresponding isolates are
disposed.
BUG=pdfium:242
Review-Url: https://codereview.chromium.org/2254123004
Diffstat (limited to 'fxjs/cfxjse_runtimedata.cpp')
-rw-r--r-- | fxjs/cfxjse_runtimedata.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fxjs/cfxjse_runtimedata.cpp b/fxjs/cfxjse_runtimedata.cpp index b203cb71ac..2c9379526e 100644 --- a/fxjs/cfxjse_runtimedata.cpp +++ b/fxjs/cfxjse_runtimedata.cpp @@ -56,11 +56,13 @@ void FXJSE_Finalize() { } v8::Isolate* FXJSE_Runtime_Create_Own() { + std::unique_ptr<v8::ArrayBuffer::Allocator> allocator( + new FXJSE_ArrayBufferAllocator()); v8::Isolate::CreateParams params; - params.array_buffer_allocator = new FXJSE_ArrayBufferAllocator(); + params.array_buffer_allocator = allocator.get(); v8::Isolate* pIsolate = v8::Isolate::New(params); ASSERT(pIsolate && CFXJSE_IsolateTracker::g_pInstance); - CFXJSE_IsolateTracker::g_pInstance->Append(pIsolate); + CFXJSE_IsolateTracker::g_pInstance->Append(pIsolate, std::move(allocator)); return pIsolate; } |