You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by hr...@apache.org on 2021/06/07 05:25:24 UTC
[pulsar-client-node] branch master updated: fix: fix leak at
MessageId::Serialize (#160)
This is an automated email from the ASF dual-hosted git repository.
hrsakai 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 07c6b1d fix: fix leak at MessageId::Serialize (#160)
07c6b1d is described below
commit 07c6b1dd8132aed4e3d50ba182c25a7e8e3cf378
Author: Yuri Mizushima <yu...@yahoo-corp.jp>
AuthorDate: Mon Jun 7 14:25:18 2021 +0900
fix: fix leak at MessageId::Serialize (#160)
---
src/MessageId.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/MessageId.cc b/src/MessageId.cc
index 82d88bb..c21a482 100644
--- a/src/MessageId.cc
+++ b/src/MessageId.cc
@@ -89,13 +89,15 @@ Napi::Value MessageId::Latest(const Napi::CallbackInfo &info) {
return obj;
}
+void serializeFinalizeCallback(Napi::Env env, char *ptr) { free(ptr); }
+
Napi::Value MessageId::Serialize(const Napi::CallbackInfo &info) {
Napi::Env env = info.Env();
int len;
void *ptr = pulsar_message_id_serialize(GetCMessageId(), &len);
- return Napi::Buffer<char>::New(env, (char *)ptr, len);
+ return Napi::Buffer<char>::New(env, (char *)ptr, len, serializeFinalizeCallback);
}
Napi::Value MessageId::Deserialize(const Napi::CallbackInfo &info) {