Merge pull request #6096 from stanley-cheung/php-fix-slice-unref

PHP: destroy grpc_byte_buffer after startBatch
pull/6133/head
Jan Tattermusch 9 years ago
commit 7ec3066956
  1. 1
      src/php/ext/grpc/byte_buffer.c
  2. 8
      src/php/ext/grpc/call.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;

@ -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);
}

Loading…
Cancel
Save