Merge pull request #1235 from murgatroid99/php_memory_leaks

Fixed memory leaks in PHP extension code
pull/1249/head
Tim Emiola 10 years ago
commit 03d6e60ef4
  1. 11
      src/php/ext/grpc/call.c
  2. 1
      src/php/ext/grpc/channel.c

@ -443,8 +443,9 @@ PHP_METHOD(Call, startBatch) {
add_property_bool(result, "send_status", true);
break;
case GRPC_OP_RECV_INITIAL_METADATA:
add_property_zval(result, "metadata",
grpc_parse_metadata_array(&recv_metadata));
array = grpc_parse_metadata_array(&recv_metadata);
add_property_zval(result, "metadata", array);
Z_DELREF_P(array);
break;
case GRPC_OP_RECV_MESSAGE:
byte_buffer_to_string(message, &message_str, &message_len);
@ -458,11 +459,13 @@ PHP_METHOD(Call, startBatch) {
case GRPC_OP_RECV_STATUS_ON_CLIENT:
MAKE_STD_ZVAL(recv_status);
object_init(recv_status);
add_property_zval(recv_status, "metadata",
grpc_parse_metadata_array(&recv_trailing_metadata));
array = grpc_parse_metadata_array(&recv_trailing_metadata);
add_property_zval(recv_status, "metadata", array);
Z_DELREF_P(array);
add_property_long(recv_status, "code", status);
add_property_string(recv_status, "details", status_details, true);
add_property_zval(result, "status", recv_status);
Z_DELREF_P(recv_status);
break;
case GRPC_OP_RECV_CLOSE_ON_SERVER:
add_property_bool(result, "cancelled", cancelled);

@ -62,6 +62,7 @@ void free_wrapped_grpc_channel(void *object TSRMLS_DC) {
if (channel->wrapped != NULL) {
grpc_channel_destroy(channel->wrapped);
}
efree(channel->target);
efree(channel);
}

Loading…
Cancel
Save