Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
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
flatbuffers
Commits
b6c3d7b8
Commit
b6c3d7b8
authored
Nov 02, 2018
by
Sumant Tambe
Committed by
Wouter van Oortmerssen
Nov 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a memory leak in builder test (#5021)
* Fix a memory leak in builder test * using RAII to free memory
parent
db0fcdd9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
test_builder.h
tests/test_builder.h
+5
-1
No files found.
tests/test_builder.h
View file @
b6c3d7b8
...
...
@@ -46,12 +46,16 @@ bool release_n_verify(flatbuffers::grpc::MessageBuilder &mbb, const std::string
// clang-format off
#if !defined(FLATBUFFERS_CPP98_STL)
// clang-format on
// Invokes this function when testing the following Builder types
// FlatBufferBuilder, TestHeapBuilder, and GrpcLikeMessageBuilder
template
<
class
Builder
>
void
builder_move_assign_after_releaseraw_test
(
Builder
b1
)
{
auto
root_offset1
=
populate1
(
b1
);
b1
.
Finish
(
root_offset1
);
size_t
size
,
offset
;
b1
.
ReleaseRaw
(
size
,
offset
);
std
::
shared_ptr
<
uint8_t
>
raw
(
b1
.
ReleaseRaw
(
size
,
offset
),
[
size
](
uint8_t
*
ptr
)
{
flatbuffers
::
DefaultAllocator
::
dealloc
(
ptr
,
size
);
});
Builder
src
;
auto
root_offset2
=
populate2
(
src
);
src
.
Finish
(
root_offset2
);
...
...
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