aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-02-13 10:40:07 -0800
committerGravatar murgatroid99 <mlumish@google.com>2015-02-13 10:40:07 -0800
commitd66408ba5a23bdaac9a9764cc28ffe13edbfafea (patch)
tree2799115aeb4145f43198e2fba2331b26cbf8e57f /src/node
parent17be589de0c41807b14fe47165e165c7d64deb9c (diff)
Improved memory management
Diffstat (limited to 'src/node')
-rw-r--r--src/node/ext/call.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc
index 18f40f2488..4d719802fc 100644
--- a/src/node/ext/call.cc
+++ b/src/node/ext/call.cc
@@ -531,7 +531,7 @@ NAN_METHOD(Call::StartBatch) {
Handle<Object> obj = args[0]->ToObject();
Handle<Array> keys = obj->GetOwnPropertyNames();
size_t nops = keys->Length();
- grpc_op *ops = new grpc_op[nops];
+ std::vector<grpc_op> ops(nops);
std::vector<unique_ptr<Op> > *op_vector = new std::vector<unique_ptr<Op> >();
for (unsigned int i = 0; i < nops; i++) {
unique_ptr<Op> op;
@@ -575,9 +575,8 @@ NAN_METHOD(Call::StartBatch) {
op_vector->push_back(std::move(op));
}
grpc_call_error error = grpc_call_start_batch(
- call->wrapped_call, ops, nops, new struct tag(
+ call->wrapped_call, &ops[0], nops, new struct tag(
callback, op_vector, resources));
- delete ops;
if (error != GRPC_CALL_OK) {
return NanThrowError("startBatch failed", error);
}