aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar alex <alex@thoughtmachine.net>2016-05-25 12:02:36 +0100
committerGravatar alex <alex@thoughtmachine.net>2016-06-02 11:08:54 +0100
commitb0f676b0503fd238550e3025346c2a8df3cc5e59 (patch)
treeed85cd7e2bac6fc81a3370f920b35fab64156a8a
parentd7bbd38b27630f908fc4f1cb906607e44c8f30bb (diff)
Fix memory leak reading from python ByteBuffer.
Fixes #5913. `grpc_byte_buffer_reader_next` is documented as 'Caller is responsible for calling gpr_slice_unref on the result', but that wasn't happening. This commit adds the missing call to `gpr_slice_unref`.
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
index c7539f0d49..e35ecd72a3 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
@@ -274,6 +274,7 @@ cdef class ByteBuffer:
data_slice_length = gpr_slice_length(data_slice)
with gil:
result += (<char *>data_slice_pointer)[:data_slice_length]
+ gpr_slice_unref(data_slice)
with nogil:
grpc_byte_buffer_reader_destroy(&reader)
return bytes(result)