Skip to content
Snippets Groups Projects
Commit 03d6e60e authored by Tim Emiola's avatar Tim Emiola
Browse files

Merge pull request #1235 from murgatroid99/php_memory_leaks

Fixed memory leaks in PHP extension code
parents 2f4811f8 aa110665
Branches
Tags
No related merge requests found
...@@ -443,8 +443,9 @@ PHP_METHOD(Call, startBatch) { ...@@ -443,8 +443,9 @@ PHP_METHOD(Call, startBatch) {
add_property_bool(result, "send_status", true); add_property_bool(result, "send_status", true);
break; break;
case GRPC_OP_RECV_INITIAL_METADATA: case GRPC_OP_RECV_INITIAL_METADATA:
add_property_zval(result, "metadata", array = grpc_parse_metadata_array(&recv_metadata);
grpc_parse_metadata_array(&recv_metadata)); add_property_zval(result, "metadata", array);
Z_DELREF_P(array);
break; break;
case GRPC_OP_RECV_MESSAGE: case GRPC_OP_RECV_MESSAGE:
byte_buffer_to_string(message, &message_str, &message_len); byte_buffer_to_string(message, &message_str, &message_len);
...@@ -458,11 +459,13 @@ PHP_METHOD(Call, startBatch) { ...@@ -458,11 +459,13 @@ PHP_METHOD(Call, startBatch) {
case GRPC_OP_RECV_STATUS_ON_CLIENT: case GRPC_OP_RECV_STATUS_ON_CLIENT:
MAKE_STD_ZVAL(recv_status); MAKE_STD_ZVAL(recv_status);
object_init(recv_status); object_init(recv_status);
add_property_zval(recv_status, "metadata", array = grpc_parse_metadata_array(&recv_trailing_metadata);
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_long(recv_status, "code", status);
add_property_string(recv_status, "details", status_details, true); add_property_string(recv_status, "details", status_details, true);
add_property_zval(result, "status", recv_status); add_property_zval(result, "status", recv_status);
Z_DELREF_P(recv_status);
break; break;
case GRPC_OP_RECV_CLOSE_ON_SERVER: case GRPC_OP_RECV_CLOSE_ON_SERVER:
add_property_bool(result, "cancelled", cancelled); add_property_bool(result, "cancelled", cancelled);
......
...@@ -62,6 +62,7 @@ void free_wrapped_grpc_channel(void *object TSRMLS_DC) { ...@@ -62,6 +62,7 @@ void free_wrapped_grpc_channel(void *object TSRMLS_DC) {
if (channel->wrapped != NULL) { if (channel->wrapped != NULL) {
grpc_channel_destroy(channel->wrapped); grpc_channel_destroy(channel->wrapped);
} }
efree(channel->target);
efree(channel); efree(channel);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment