From f64befd27fb08104fb5d1a7006d4f8ac08510f8f Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 21 Mar 2016 14:04:10 -0700 Subject: Make a copy of ByteBuffer when writing --- include/grpc++/support/byte_buffer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/grpc++/support') diff --git a/include/grpc++/support/byte_buffer.h b/include/grpc++/support/byte_buffer.h index 82591a88ef..27307f8fcd 100644 --- a/include/grpc++/support/byte_buffer.h +++ b/include/grpc++/support/byte_buffer.h @@ -99,8 +99,8 @@ class SerializationTraits { } static Status Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer, bool* own_buffer) { - *buffer = source.buffer(); - *own_buffer = false; + *buffer = grpc_byte_buffer_copy(source.buffer()); + *own_buffer = true; return Status::OK; } }; -- cgit v1.2.3