diff options
Diffstat (limited to 'src/string_bytes.cc')
-rw-r--r-- | src/string_bytes.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/string_bytes.cc b/src/string_bytes.cc index 36525a73ac..0abdbf85bb 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -704,7 +704,8 @@ Local<Value> StringBytes::Encode(Isolate* isolate, switch (encoding) { case BUFFER: { - Local<Object> vbuf = Buffer::New(isolate, buf, buflen).ToLocalChecked(); + Local<Object> vbuf = + Buffer::Copy(isolate, buf, buflen).ToLocalChecked(); return scope.Escape(vbuf); } |