aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-07-31 10:25:12 -0700
committerGravatar Muxi Yan <mxyan@google.com>2017-07-31 10:25:12 -0700
commit6a8355de45efefb4cad388dfb639a8713e66de57 (patch)
treecf4eeeea307847ab6b5eddb4e0a9f7683ed85449
parent433f7bce2d5a6683e9d60a147b528bb9be98baff (diff)
Fix two memory leaks
-rw-r--r--src/core/ext/transport/cronet/transport/cronet_transport.c3
-rw-r--r--src/objective-c/GRPCClient/private/NSData+GRPC.m2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c
index 29dfa885de..776e0765fe 100644
--- a/src/core/ext/transport/cronet/transport/cronet_transport.c
+++ b/src/core/ext/transport/cronet/transport/cronet_transport.c
@@ -968,6 +968,9 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx,
s->header_array.capacity = s->header_array.count;
CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url);
bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false);
+ if (url) {
+ gpr_free(url);
+ }
unsigned int header_index;
for (header_index = 0; header_index < s->header_array.count;
header_index++) {
diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.m b/src/objective-c/GRPCClient/private/NSData+GRPC.m
index 7ee76ad333..7c46594dd5 100644
--- a/src/objective-c/GRPCClient/private/NSData+GRPC.m
+++ b/src/objective-c/GRPCClient/private/NSData+GRPC.m
@@ -47,6 +47,8 @@ static void MallocAndCopyByteBufferToCharArray(grpc_byte_buffer *buffer,
grpc_slice_unref(slice);
*array = result;
*length = uncompressed_length;
+
+ grpc_byte_buffer_reader_destroy(&reader);
}
static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array,