diff options
author | Seongjin Cho <sjcho@wisefour.com> | 2015-11-30 05:15:58 +0900 |
---|---|---|
committer | Seongjin Cho <sjcho@wisefour.com> | 2015-11-30 05:15:58 +0900 |
commit | 8b77d61d8ff204780770e8e2a13b586526f3ef3b (patch) | |
tree | 80f2e761182aa00d9292075e73ebecf359f2a7fa | |
parent | 945836eade7d8f12f6eb84bc209da13ae7c89b38 (diff) |
Memory leak fix?
-rw-r--r-- | src/node/ext/call.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index a98ae85427..c0e2b0f0e8 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -234,6 +234,14 @@ class SendMetadataOp : public Op { class SendMessageOp : public Op { public: + SendMessageOp() { + send_message = NULL; + } + ~SendMessageOp() { + if (send_message != NULL) { + grpc_byte_buffer_destroy(send_message); + } + } Local<Value> GetNodeValue() const { EscapableHandleScope scope; return scope.Escape(Nan::True()); @@ -253,7 +261,8 @@ class SendMessageOp : public Op { out->flags = maybe_flag.FromMaybe(0) & GRPC_WRITE_USED_MASK; } } - out->data.send_message = BufferToByteBuffer(value); + send_message = BufferToByteBuffer(value); + out->data.send_message = send_message; PersistentValue *handle = new PersistentValue(value); resources->handles.push_back(unique_ptr<PersistentValue>(handle)); return true; @@ -262,6 +271,8 @@ class SendMessageOp : public Op { std::string GetTypeString() const { return "send_message"; } + private: + grpc_byte_buffer *send_message; }; class SendClientCloseOp : public Op { |