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
60340ac5
Commit
60340ac5
authored
Apr 11, 2019
by
Vladimir Glavnyy
Committed by
Wouter van Oortmerssen
Apr 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the proto-enum leaking issue (#5286)
* Detect leak with sanitizer * Fix proto-enum leak issue
parent
2bd4a275
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
2 deletions
+13
-2
idl_parser.cpp
src/idl_parser.cpp
+10
-2
test.golden
tests/prototest/test.golden
+1
-0
test.proto
tests/prototest/test.proto
+1
-0
test_union.golden
tests/prototest/test_union.golden
+1
-0
No files found.
src/idl_parser.cpp
View file @
60340ac5
...
...
@@ -2035,10 +2035,18 @@ CheckedError Parser::ParseProtoDecl() {
// Temp: remove any duplicates, as .fbs files can't handle them.
for
(
auto
it
=
v
.
begin
();
it
!=
v
.
end
();)
{
if
(
it
!=
v
.
begin
()
&&
it
[
0
]
->
value
==
it
[
-
1
]
->
value
)
if
(
it
!=
v
.
begin
()
&&
it
[
0
]
->
value
==
it
[
-
1
]
->
value
)
{
auto
ref
=
it
[
-
1
];
auto
ev
=
it
[
0
];
for
(
auto
dit
=
enum_def
->
vals
.
dict
.
begin
();
dit
!=
enum_def
->
vals
.
dict
.
end
();
++
dit
)
{
if
(
dit
->
second
==
ev
)
dit
->
second
=
ref
;
// reassign
}
delete
ev
;
// delete enum value
it
=
v
.
erase
(
it
);
else
}
else
{
++
it
;
}
}
}
else
if
(
IsIdent
(
"syntax"
))
{
// Skip these.
NEXT
();
...
...
tests/prototest/test.golden
View file @
60340ac5
...
...
@@ -4,6 +4,7 @@ namespace proto.test;
/// Enum doc comment.
enum ProtoEnum : int {
NUL = 0,
FOO = 1,
/// Enum 2nd value doc comment misaligned.
BAR = 5,
...
...
tests/prototest/test.proto
View file @
60340ac5
...
...
@@ -8,6 +8,7 @@ package proto.test;
/// Enum doc comment.
enum
ProtoEnum
{
option
allow_alias
=
true
;
NUL
=
0
;
FOO
=
1
;
/// Enum 2nd value doc comment misaligned.
BAR
=
5
;
...
...
tests/prototest/test_union.golden
View file @
60340ac5
...
...
@@ -4,6 +4,7 @@ namespace proto.test;
/// Enum doc comment.
enum ProtoEnum : int {
NUL = 0,
FOO = 1,
/// Enum 2nd value doc comment misaligned.
BAR = 5,
...
...
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