Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
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
protobuf
Commits
449e532b
Unverified
Commit
449e532b
authored
May 24, 2018
by
Adam Cozzette
Committed by
GitHub
May 24, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4673 from acozzette/memory-leak-fix
Make sure to delete temporary maps used by FileDescriptorTables
parents
15cde292
daf039b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
descriptor.cc
src/google/protobuf/descriptor.cc
+6
-8
No files found.
src/google/protobuf/descriptor.cc
View file @
449e532b
...
...
@@ -775,10 +775,10 @@ class FileDescriptorTables {
SymbolsByParentMap
symbols_by_parent_
;
mutable
FieldsByNameMap
fields_by_lowercase_name_
;
mutable
FieldsByNameMap
*
fields_by_lowercase_name_tmp_
;
std
::
unique_ptr
<
FieldsByNameMap
>
fields_by_lowercase_name_tmp_
;
mutable
GoogleOnceDynamic
fields_by_lowercase_name_once_
;
mutable
FieldsByNameMap
fields_by_camelcase_name_
;
mutable
FieldsByNameMap
*
fields_by_camelcase_name_tmp_
;
std
::
unique_ptr
<
FieldsByNameMap
>
fields_by_camelcase_name_tmp_
;
mutable
GoogleOnceDynamic
fields_by_camelcase_name_once_
;
FieldsByNumberMap
fields_by_number_
;
// Not including extensions.
EnumValuesByNumberMap
enum_values_by_number_
;
...
...
@@ -1146,10 +1146,8 @@ bool DescriptorPool::Tables::AddFile(const FileDescriptor* file) {
void
FileDescriptorTables
::
FinalizeTables
()
{
// Clean up the temporary maps used by AddFieldByStylizedNames().
delete
fields_by_lowercase_name_tmp_
;
fields_by_lowercase_name_tmp_
=
NULL
;
delete
fields_by_camelcase_name_tmp_
;
fields_by_camelcase_name_tmp_
=
NULL
;
fields_by_lowercase_name_tmp_
=
nullptr
;
fields_by_camelcase_name_tmp_
=
nullptr
;
}
void
FileDescriptorTables
::
AddFieldByStylizedNames
(
...
...
@@ -1164,7 +1162,7 @@ void FileDescriptorTables::AddFieldByStylizedNames(
// entries from fields_by_number_.
PointerStringPair
lowercase_key
(
parent
,
field
->
lowercase_name
().
c_str
());
if
(
!
InsertIfNotPresent
(
fields_by_lowercase_name_tmp_
,
lowercase_key
,
if
(
!
InsertIfNotPresent
(
fields_by_lowercase_name_tmp_
.
get
()
,
lowercase_key
,
field
))
{
InsertIfNotPresent
(
&
fields_by_lowercase_name_
,
lowercase_key
,
...
...
@@ -1172,7 +1170,7 @@ void FileDescriptorTables::AddFieldByStylizedNames(
}
PointerStringPair
camelcase_key
(
parent
,
field
->
camelcase_name
().
c_str
());
if
(
!
InsertIfNotPresent
(
fields_by_camelcase_name_tmp_
,
camelcase_key
,
if
(
!
InsertIfNotPresent
(
fields_by_camelcase_name_tmp_
.
get
()
,
camelcase_key
,
field
))
{
InsertIfNotPresent
(
&
fields_by_camelcase_name_
,
camelcase_key
,
...
...
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