aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/ext
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-04-08 16:53:47 -0700
committerGravatar murgatroid99 <mlumish@google.com>2015-04-08 16:53:47 -0700
commitaa11066573722b704c718f418514735f1c86edb6 (patch)
tree105f7f00c83cd16c6bc4742beb716a7c94e877c7 /src/php/ext
parentbc83a5ea0e5302dc103174e680976704c8639fb3 (diff)
Fixed memory leaks in PHP extension code
Diffstat (limited to 'src/php/ext')
-rw-r--r--src/php/ext/grpc/call.c11
-rw-r--r--src/php/ext/grpc/channel.c1
2 files changed, 8 insertions, 4 deletions
diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c
index 6bc65b5367..b1525e9246 100644
--- a/src/php/ext/grpc/call.c
+++ b/src/php/ext/grpc/call.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);
diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c
index 51a3eae0f4..b8262db162 100644
--- a/src/php/ext/grpc/channel.c
+++ b/src/php/ext/grpc/channel.c
@@ -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);
}