aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php
diff options
context:
space:
mode:
authorGravatar Stanley Cheung <stanleycheung@google.com>2016-04-06 11:51:57 -0700
committerGravatar Stanley Cheung <stanleycheung@google.com>2016-04-06 11:51:57 -0700
commit82e6f32d640d3dc826c1956e01e6c491ed1f0ad1 (patch)
tree80111f2028623104b84a62677626764aa999db15 /src/php
parent8dbf476ac369c6f9cceb6f76a70fa739efce7e9b (diff)
php: destroy grpc_byte_buffer after startBatch
Diffstat (limited to 'src/php')
-rw-r--r--src/php/ext/grpc/byte_buffer.c1
-rw-r--r--src/php/ext/grpc/call.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/src/php/ext/grpc/byte_buffer.c b/src/php/ext/grpc/byte_buffer.c
index 8be0a20607..7a726de5db 100644
--- a/src/php/ext/grpc/byte_buffer.c
+++ b/src/php/ext/grpc/byte_buffer.c
@@ -72,6 +72,7 @@ void byte_buffer_to_string(grpc_byte_buffer *buffer, char **out_string,
while (grpc_byte_buffer_reader_next(&reader, &next) != 0) {
memcpy(string + offset, GPR_SLICE_START_PTR(next), GPR_SLICE_LENGTH(next));
offset += GPR_SLICE_LENGTH(next);
+ gpr_slice_unref(next);
}
*out_string = string;
*out_length = length;
diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c
index 024ab70571..a0f3d160c6 100644
--- a/src/php/ext/grpc/call.c
+++ b/src/php/ext/grpc/call.c
@@ -492,6 +492,14 @@ cleanup:
if (status_details != NULL) {
gpr_free(status_details);
}
+ for (int i = 0; i < op_num; i++) {
+ if (ops[i].op == GRPC_OP_SEND_MESSAGE) {
+ grpc_byte_buffer_destroy(ops[i].data.send_message);
+ }
+ if (ops[i].op == GRPC_OP_RECV_MESSAGE) {
+ grpc_byte_buffer_destroy(message);
+ }
+ }
RETURN_DESTROY_ZVAL(result);
}