Commit c9e3131a authored by Ge Jun's avatar Ge Jun

the buffer passed to TMemoryBuffer should be malloc-ed instead of new[]

parent 18a96d5b
......@@ -122,7 +122,7 @@ bool ReadThriftStruct(const butil::IOBuf& body,
ThriftMessageBase* raw_msg,
int16_t expected_fid) {
const size_t body_len = body.size();
uint8_t* thrift_buffer = new uint8_t[body_len];
uint8_t* thrift_buffer = (uint8_t*)malloc(body_len);
body.copy_to(thrift_buffer, body_len);
auto in_buffer =
THRIFT_STDCXX::make_shared<apache::thrift::transport::TMemoryBuffer>(
......@@ -165,7 +165,7 @@ bool ReadThriftStruct(const butil::IOBuf& body,
void ReadThriftException(const butil::IOBuf& body,
::apache::thrift::TApplicationException* x) {
size_t body_len = body.size();
uint8_t* thrift_buffer = new uint8_t[body_len];
uint8_t* thrift_buffer = (uint8_t*)malloc(body_len);
body.copy_to(thrift_buffer, body_len);
auto in_buffer =
THRIFT_STDCXX::make_shared<apache::thrift::transport::TMemoryBuffer>(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment