Skip to content
Snippets Groups Projects
Commit 5fbfa184 authored by Muxi Yan's avatar Muxi Yan Committed by GitHub
Browse files

Merge pull request #11991 from muxi/fix-objc-nsdata-memory-leak

Fix two memory leak points in ObjC
parents dc1cfe9e 6a8355de
No related branches found
No related tags found
No related merge requests found
...@@ -968,6 +968,9 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, ...@@ -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; s->header_array.capacity = s->header_array.count;
CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url); CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url);
bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false); bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false);
if (url) {
gpr_free(url);
}
unsigned int header_index; unsigned int header_index;
for (header_index = 0; header_index < s->header_array.count; for (header_index = 0; header_index < s->header_array.count;
header_index++) { header_index++) {
......
...@@ -47,6 +47,8 @@ static void MallocAndCopyByteBufferToCharArray(grpc_byte_buffer *buffer, ...@@ -47,6 +47,8 @@ static void MallocAndCopyByteBufferToCharArray(grpc_byte_buffer *buffer,
grpc_slice_unref(slice); grpc_slice_unref(slice);
*array = result; *array = result;
*length = uncompressed_length; *length = uncompressed_length;
grpc_byte_buffer_reader_destroy(&reader);
} }
static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array, static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment