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
e83ba13a
Commit
e83ba13a
authored
Oct 08, 2014
by
Antoni Buszta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InitializeDefaultRepeatedFields() allocates memory but does not release it.
parent
0971bb0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
extension_set.cc
src/google/protobuf/extension_set.cc
+15
-0
extension_set.h
src/google/protobuf/extension_set.h
+4
-0
No files found.
src/google/protobuf/extension_set.cc
View file @
e83ba13a
...
...
@@ -1622,6 +1622,9 @@ struct StaticDefaultRepeatedFieldsInitializer {
StaticDefaultRepeatedFieldsInitializer
()
{
InitializeDefaultRepeatedFields
();
}
~
StaticDefaultRepeatedFieldsInitializer
()
{
DestroyDefaultRepeatedFields
();
}
}
static_repeated_fields_initializer
;
void
InitializeDefaultRepeatedFields
()
{
...
...
@@ -1645,6 +1648,18 @@ void InitializeDefaultRepeatedFields() {
new
RepeatedField
<
bool
>
;
}
void
DestroyDefaultRepeatedFields
()
{
delete
RepeatedStringTypeTraits
::
default_repeated_field_
;
delete
RepeatedMessageGenericTypeTraits
::
default_repeated_field_
;
delete
RepeatedPrimitiveGenericTypeTraits
::
default_repeated_field_int32_
;
delete
RepeatedPrimitiveGenericTypeTraits
::
default_repeated_field_int64_
;
delete
RepeatedPrimitiveGenericTypeTraits
::
default_repeated_field_uint32_
;
delete
RepeatedPrimitiveGenericTypeTraits
::
default_repeated_field_uint64_
;
delete
RepeatedPrimitiveGenericTypeTraits
::
default_repeated_field_double_
;
delete
RepeatedPrimitiveGenericTypeTraits
::
default_repeated_field_float_
;
delete
RepeatedPrimitiveGenericTypeTraits
::
default_repeated_field_bool_
;
}
}
// namespace internal
}
// namespace protobuf
}
// namespace google
src/google/protobuf/extension_set.h
View file @
e83ba13a
...
...
@@ -704,11 +704,13 @@ class RepeatedPrimitiveTypeTraits {
// Declared here so that this can be friended below.
void
InitializeDefaultRepeatedFields
();
void
DestroyDefaultRepeatedFields
();
class
LIBPROTOBUF_EXPORT
RepeatedPrimitiveGenericTypeTraits
{
private
:
template
<
typename
Type
>
friend
class
RepeatedPrimitiveTypeTraits
;
friend
void
InitializeDefaultRepeatedFields
();
friend
void
DestroyDefaultRepeatedFields
();
static
const
RepeatedField
<
int32
>*
default_repeated_field_int32_
;
static
const
RepeatedField
<
int64
>*
default_repeated_field_int64_
;
static
const
RepeatedField
<
uint32
>*
default_repeated_field_uint32_
;
...
...
@@ -844,6 +846,7 @@ class LIBPROTOBUF_EXPORT RepeatedStringTypeTraits {
private
:
friend
void
InitializeDefaultRepeatedFields
();
friend
void
DestroyDefaultRepeatedFields
();
static
const
RepeatedFieldType
*
default_repeated_field_
;
};
...
...
@@ -1010,6 +1013,7 @@ class LIBPROTOBUF_EXPORT RepeatedMessageGenericTypeTraits {
private
:
template
<
typename
Type
>
friend
class
RepeatedMessageTypeTraits
;
friend
void
InitializeDefaultRepeatedFields
();
friend
void
DestroyDefaultRepeatedFields
();
static
const
RepeatedFieldType
*
default_repeated_field_
;
};
...
...
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