| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 43c6912d5d928b28d9b0368266e34fa7957078ae..d532f34af8a3999ebc1bde7cf2409871d78b6794 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -7590,9 +7590,14 @@ MaybeLocal<WasmCompiledModule> WasmCompiledModule::Compile(Isolate* isolate,
|
| Utils::ToLocal(maybe_compiled.ToHandleChecked()));
|
| }
|
|
|
| -void WasmModuleObjectBuilder::OnBytesReceived(
|
| - std::unique_ptr<const uint8_t[]>&& bytes, size_t size) {
|
| - received_buffers_.push_back(Buffer(std::move(bytes), size));
|
| +void WasmModuleObjectBuilder::OnBytesReceived(const uint8_t* bytes,
|
| + size_t size) {
|
| + std::unique_ptr<uint8_t[]> cloned_bytes(new uint8_t[size]);
|
| + memcpy(cloned_bytes.get(), bytes, size);
|
| + received_buffers_.push_back(
|
| + Buffer(std::unique_ptr<const uint8_t[]>(
|
| + const_cast<const uint8_t*>(cloned_bytes.release())),
|
| + size));
|
| total_size_ += size;
|
| }
|
|
|
|
|