This is an automated email from the ASF dual-hosted git repository.

massakam pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-node.git


The following commit(s) were added to refs/heads/master by this push:
     new f34c23b  Use Buffer::Copy instead of Buffer::New (#163)
f34c23b is described below

commit f34c23b65f655bf61e176d374997dd2b89ed0976
Author: hrsakai <[email protected]>
AuthorDate: Tue Jul 20 13:21:59 2021 +0900

    Use Buffer::Copy instead of Buffer::New (#163)
---
 src/Message.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Message.cc b/src/Message.cc
index a44d225..56cf652 100644
--- a/src/Message.cc
+++ b/src/Message.cc
@@ -102,7 +102,7 @@ Napi::Value Message::GetData(const Napi::CallbackInfo 
&info) {
   }
   void *data = const_cast<void *>(pulsar_message_get_data(this->cMessage));
   size_t size = (size_t)pulsar_message_get_length(this->cMessage);
-  return Napi::Buffer<char>::New(env, (char *)data, size);
+  return Napi::Buffer<char>::Copy(env, (char *)data, size);
 }
 
 Napi::Value Message::GetMessageId(const Napi::CallbackInfo &info) {

Reply via email to