Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
c9e3131a
Commit
c9e3131a
authored
Jul 18, 2018
by
Ge Jun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the buffer passed to TMemoryBuffer should be malloc-ed instead of new[]
parent
18a96d5b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
thrift_protocol.cpp
src/brpc/policy/thrift_protocol.cpp
+2
-2
No files found.
src/brpc/policy/thrift_protocol.cpp
View file @
c9e3131a
...
...
@@ -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
>
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment