diff options
author | Seongjin Cho <sjcho@wisefour.com> | 2015-11-30 05:15:58 +0900 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2015-12-03 11:42:32 -0800 |
commit | b531f76c6272a2cd3996fc50b505255935494761 (patch) | |
tree | 0714ed2201c9eec150f4a0c385c73285e87fdc9e /src/node/ext | |
parent | 873d04bc3dfcfc8c5719210e05e5284436002d9c (diff) |
Memory leak fix?
Diffstat (limited to 'src/node/ext')
-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 { |