aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_utilities/bootstrap_file.cpp
diff options
context:
space:
mode:
authorMaxXor <admin@maxxor.org>2017-11-08 19:59:09 +0100
committerMaxXor <admin@maxxor.org>2017-11-08 19:59:09 +0100
commitc957795bfae2ead9e2756cfcd86b3b65d0660d83 (patch)
tree9a05a327e2033eace3ce815de195ccea7a5dd96e /src/blockchain_utilities/bootstrap_file.cpp
parentMerge pull request #2764 (diff)
downloadmonero-c957795bfae2ead9e2756cfcd86b3b65d0660d83.tar.xz
fix output_stream_header memory leak
Diffstat (limited to '')
-rw-r--r--src/blockchain_utilities/bootstrap_file.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/blockchain_utilities/bootstrap_file.cpp b/src/blockchain_utilities/bootstrap_file.cpp
index a004d3547..25b9df58f 100644
--- a/src/blockchain_utilities/bootstrap_file.cpp
+++ b/src/blockchain_utilities/bootstrap_file.cpp
@@ -134,8 +134,7 @@ bool BootstrapFile::initialize_file()
bbi.block_last_pos = 0;
buffer_type buffer2;
- boost::iostreams::stream<boost::iostreams::back_insert_device<buffer_type>>* output_stream_header;
- output_stream_header = new boost::iostreams::stream<boost::iostreams::back_insert_device<buffer_type>>(buffer2);
+ boost::iostreams::stream<boost::iostreams::back_insert_device<buffer_type>> output_stream_header(buffer2);
uint32_t bd_size = 0;
@@ -147,8 +146,8 @@ bool BootstrapFile::initialize_file()
{
throw std::runtime_error("Error in serialization of bootstrap::file_info size");
}
- *output_stream_header << blob;
- *output_stream_header << bd;
+ output_stream_header << blob;
+ output_stream_header << bd;
bd = t_serializable_object_to_blob(bbi);
MDEBUG("bootstrap::blocks_info size: " << bd.size());
@@ -158,12 +157,12 @@ bool BootstrapFile::initialize_file()
{
throw std::runtime_error("Error in serialization of bootstrap::blocks_info size");
}
- *output_stream_header << blob;
- *output_stream_header << bd;
+ output_stream_header << blob;
+ output_stream_header << bd;
- output_stream_header->flush();
- *output_stream_header << std::string(header_size-buffer2.size(), 0); // fill in rest with null bytes
- output_stream_header->flush();
+ output_stream_header.flush();
+ output_stream_header << std::string(header_size-buffer2.size(), 0); // fill in rest with null bytes
+ output_stream_header.flush();
std::copy(buffer2.begin(), buffer2.end(), std::ostreambuf_iterator<char>(*m_raw_data_file));
return true;