aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-04-08 13:37:12 -0700
committerGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-04-08 13:37:12 -0700
commit7ec3066956859648726aa9680665f6f9309d64cc (patch)
tree7ba5936787c884068e339a91c26605222b0fa0a5 /src
parent2fd92fb111132db4f772baa829fb96731e37e8ad (diff)
parent82e6f32d640d3dc826c1956e01e6c491ed1f0ad1 (diff)
Merge pull request #6096 from stanley-cheung/php-fix-slice-unref
PHP: destroy grpc_byte_buffer after startBatch
Diffstat (limited to 'src')
-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);
}