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
f9fa0590
Commit
f9fa0590
authored
Jan 08, 2010
by
kenton@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leak in CommandLineInterface, not that it really matters.
parent
38fcd392
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
command_line_interface.cc
src/google/protobuf/compiler/command_line_interface.cc
+9
-5
No files found.
src/google/protobuf/compiler/command_line_interface.cc
View file @
f9fa0590
...
...
@@ -607,10 +607,9 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
// that two code generators may output to the same location, in which case
// they should share a single OutputDirectory (so that OpenForInsert() works).
typedef
hash_map
<
string
,
MemoryOutputDirectory
*>
OutputDirectoryMap
;
OutputDirectoryMap
output_directories
_
;
OutputDirectoryMap
output_directories
;
// Generate output.
MemoryOutputDirectory
output_directory
;
if
(
mode_
==
MODE_COMPILE
)
{
for
(
int
i
=
0
;
i
<
output_directives_
.
size
();
i
++
)
{
string
output_location
=
output_directives_
[
i
].
output_location
;
...
...
@@ -618,7 +617,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
!
HasSuffixString
(
output_location
,
".jar"
))
{
AddTrailingSlash
(
&
output_location
);
}
MemoryOutputDirectory
**
map_slot
=
&
output_directories
_
[
output_location
];
MemoryOutputDirectory
**
map_slot
=
&
output_directories
[
output_location
];
if
(
*
map_slot
==
NULL
)
{
// First time we've seen this output location.
...
...
@@ -626,18 +625,20 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
}
if
(
!
GenerateOutput
(
parsed_files
,
output_directives_
[
i
],
*
map_slot
))
{
STLDeleteValues
(
&
output_directories
);
return
1
;
}
}
}
// Write all output to disk.
for
(
OutputDirectoryMap
::
iterator
iter
=
output_directories
_
.
begin
();
iter
!=
output_directories
_
.
end
();
++
iter
)
{
for
(
OutputDirectoryMap
::
iterator
iter
=
output_directories
.
begin
();
iter
!=
output_directories
.
end
();
++
iter
)
{
const
string
&
location
=
iter
->
first
;
MemoryOutputDirectory
*
directory
=
iter
->
second
;
if
(
HasSuffixString
(
location
,
"/"
))
{
if
(
!
directory
->
WriteAllToDisk
(
location
))
{
STLDeleteValues
(
&
output_directories
);
return
1
;
}
}
else
{
...
...
@@ -646,11 +647,14 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) {
}
if
(
!
directory
->
WriteAllToZip
(
location
))
{
STLDeleteValues
(
&
output_directories
);
return
1
;
}
}
}
STLDeleteValues
(
&
output_directories
);
if
(
!
descriptor_set_name_
.
empty
())
{
if
(
!
WriteDescriptorSet
(
parsed_files
))
{
return
1
;
...
...
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