mirror of https://github.com/grpc/grpc-node.git
Remember to unref the slice
This commit is contained in:
parent
af02b8c087
commit
717dc41926
|
@ -78,6 +78,7 @@ Local<Value> ByteBufferToBuffer(grpc_byte_buffer *buffer) {
|
||||||
size_t length = GPR_SLICE_LENGTH(slice);
|
size_t length = GPR_SLICE_LENGTH(slice);
|
||||||
char *result = new char[length];
|
char *result = new char[length];
|
||||||
memcpy(result, GPR_SLICE_START_PTR(slice), length);
|
memcpy(result, GPR_SLICE_START_PTR(slice), length);
|
||||||
|
gpr_slice_unref(slice);
|
||||||
return scope.Escape(MakeFastBuffer(
|
return scope.Escape(MakeFastBuffer(
|
||||||
Nan::NewBuffer(result, length, delete_buffer, NULL).ToLocalChecked()));
|
Nan::NewBuffer(result, length, delete_buffer, NULL).ToLocalChecked()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue