Skip to content

Commit d205e50

Browse files
committed
buffer: avoid creating the backing store in the thread
Fixes: #37030
1 parent dbdc14b commit d205e50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node_blob.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ void FixedSizeBlobCopyJob::AfterThreadPoolWork(int status) {
255255

256256
void FixedSizeBlobCopyJob::DoThreadPoolWork() {
257257
Environment* env = AsyncWrap::env();
258-
destination_ = ArrayBuffer::NewBackingStore(env->isolate(), length_);
259258
unsigned char* dest = static_cast<unsigned char*>(destination_->Data());
260259
if (length_ > 0) {
261260
size_t total = 0;
@@ -314,6 +313,8 @@ void FixedSizeBlobCopyJob::Run(const FunctionCallbackInfo<Value>& args) {
314313
Environment* env = Environment::GetCurrent(args);
315314
FixedSizeBlobCopyJob* job;
316315
ASSIGN_OR_RETURN_UNWRAP(&job, args.Holder());
316+
job->destination_ =
317+
ArrayBuffer::NewBackingStore(env->isolate(), job->length_);
317318
if (job->mode() == FixedSizeBlobCopyJob::Mode::ASYNC)
318319
return job->ScheduleWork();
319320

0 commit comments

Comments
 (0)