You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ma...@apache.org on 2021/06/01 07:29:50 UTC
[pulsar-client-node] branch master updated: fix leak
MessageId::ToString (#159)
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 1bd357d fix leak MessageId::ToString (#159)
1bd357d is described below
commit 1bd357d71461c7a451fb8fb8da5750e7eb530433
Author: Yuto Furuta <mz...@gmail.com>
AuthorDate: Tue Jun 1 16:29:42 2021 +0900
fix leak MessageId::ToString (#159)
Co-authored-by: Yuto Furuta <yf...@yahoo-corp.jp>
---
src/MessageId.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/MessageId.cc b/src/MessageId.cc
index ad9a195..82d88bb 100644
--- a/src/MessageId.cc
+++ b/src/MessageId.cc
@@ -17,6 +17,8 @@
* under the License.
*/
+#include <stdlib.h>
+
#include "MessageId.h"
#include <pulsar/c/message.h>
#include <pulsar/c/message_id.h>
@@ -117,7 +119,10 @@ Napi::Value MessageId::Deserialize(const Napi::CallbackInfo &info) {
pulsar_message_id_t *MessageId::GetCMessageId() { return this->cMessageId; }
Napi::Value MessageId::ToString(const Napi::CallbackInfo &info) {
- return Napi::String::New(info.Env(), pulsar_message_id_str(this->cMessageId));
+ char *cStr = pulsar_message_id_str(this->cMessageId);
+ std::string s(cStr);
+ free(cStr);
+ return Napi::String::New(info.Env(), s);
}
MessageId::~MessageId() {