diff options
author | Masood Malekghassemi <atash@google.com> | 2017-01-18 17:47:52 -0800 |
---|---|---|
committer | Masood Malekghassemi <atash@google.com> | 2017-01-19 16:21:45 -0800 |
commit | c4d10dfb1b65f6e559db55ad8448ab37fc8d4fa8 (patch) | |
tree | f55ec664aec29fe230af69c6389a7e9a483a2b2c /src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi | |
parent | 5a96770fe305710ae9154779bc9bb8e603b65345 (diff) |
Fix Python memory errors
... but for real this time.
Diffstat (limited to 'src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi')
-rw-r--r-- | src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index e4c24a83ab..246e8399bc 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -60,24 +60,25 @@ cdef class Channel: method, host, Timespec deadline not None): if queue.is_shutting_down: raise ValueError("queue must not be shutting down or shutdown") - cdef Slice method_slice = Slice.from_bytes(method) - cdef Slice host_slice - cdef grpc_slice *host_c_slice = NULL + cdef grpc_slice method_slice = _slice_from_bytes(method) + cdef grpc_slice host_slice + cdef grpc_slice *host_slice_ptr = NULL if host is not None: - host_slice = Slice.from_bytes(host) - host_c_slice = &host_slice.c_slice - else: - host_slice = Slice() + host_slice = _slice_from_bytes(host) + host_slice_ptr = &host_slice cdef Call operation_call = Call() - operation_call.references = [self, method_slice, host_slice, queue] + operation_call.references = [self, queue] cdef grpc_call *parent_call = NULL if parent is not None: parent_call = parent.c_call with nogil: operation_call.c_call = grpc_channel_create_call( self.c_channel, parent_call, flags, - queue.c_completion_queue, method_slice.c_slice, host_c_slice, + queue.c_completion_queue, method_slice, host_slice_ptr, deadline.c_time, NULL) + grpc_slice_unref(method_slice) + if host_slice_ptr: + grpc_slice_unref(host_slice) return operation_call def check_connectivity_state(self, bint try_to_connect): |