From 474f53b13835b5f42e0ef86947497eba28b45441 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 14 Sep 2015 13:53:07 -0700 Subject: Fixed Op destructors not being called --- src/node/ext/call.cc | 5 ++++- src/node/ext/call.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 560869e6fa..49b306202b 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -172,6 +172,9 @@ Handle Op::GetOpType() const { return NanEscapeScope(NanNew(GetTypeString())); } +Op::~Op() { +} + class SendMetadataOp : public Op { public: Handle GetNodeValue() const { @@ -325,7 +328,7 @@ class ReadMessageOp : public Op { } ~ReadMessageOp() { if (recv_message != NULL) { - gpr_free(recv_message); + grpc_byte_buffer_destroy(recv_message); } } Handle GetNodeValue() const { diff --git a/src/node/ext/call.h b/src/node/ext/call.h index 89f81dcf4d..a01f03489e 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -88,6 +88,7 @@ struct Resources { class Op { public: + virtual ~Op(); virtual v8::Handle GetNodeValue() const = 0; virtual bool ParseOp(v8::Handle value, grpc_op *out, shared_ptr resources) = 0; @@ -98,7 +99,6 @@ class Op { }; typedef std::vector> OpVec; - struct tag { tag(NanCallback *callback, OpVec *ops, shared_ptr resources); -- cgit v1.2.3 From 640325e65eb52c213be8349b7f4400cf4cc7f62e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 14 Sep 2015 14:16:04 -0700 Subject: Fixed memory leak in Buffer construction --- src/node/ext/byte_buffer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc index 7eff11c2b3..fe7735d429 100644 --- a/src/node/ext/byte_buffer.cc +++ b/src/node/ext/byte_buffer.cc @@ -77,7 +77,7 @@ Handle ByteBufferToBuffer(grpc_byte_buffer *buffer) { memcpy(result + offset, GPR_SLICE_START_PTR(next), GPR_SLICE_LENGTH(next)); offset += GPR_SLICE_LENGTH(next); } - return NanEscapeScope(MakeFastBuffer(NanNewBufferHandle(result, length))); + return NanEscapeScope(MakeFastBuffer(NanBufferUse(result, length))); } Handle MakeFastBuffer(Handle slowBuffer) { -- cgit v1.2.3