diff --git a/MongoDB/src/Binary.cpp b/MongoDB/src/Binary.cpp index 2cd18f81f..ea814d696 100644 --- a/MongoDB/src/Binary.cpp +++ b/MongoDB/src/Binary.cpp @@ -19,7 +19,7 @@ namespace Poco { namespace MongoDB { -Binary::Binary(): +Binary::Binary(): _buffer(0), _subtype(0) { @@ -27,14 +27,14 @@ Binary::Binary(): Binary::Binary(Poco::Int32 size, unsigned char subtype): - _buffer(size), + _buffer(size), _subtype(subtype) { } Binary::Binary(const UUID& uuid): - _buffer(128 / 8), + _buffer(128 / 8), _subtype(0x04) { unsigned char szUUID[16]; @@ -44,14 +44,14 @@ Binary::Binary(const UUID& uuid): -Binary::Binary(const std::string& data, unsigned char subtype): +Binary::Binary(const std::string& data, unsigned char subtype): _buffer(reinterpret_cast(data.data()), data.size()), _subtype(subtype) { } - -Binary::Binary(const void* data, Poco::Int32 size, unsigned char subtype): + +Binary::Binary(const void* data, Poco::Int32 size, unsigned char subtype): _buffer(reinterpret_cast(data), size), _subtype(subtype) { @@ -69,6 +69,7 @@ std::string Binary::toString(int indent) const Base64Encoder encoder(oss); MemoryInputStream mis((const char*) _buffer.begin(), _buffer.size()); StreamCopier::copyStream(mis, encoder); + encoder.close(); return oss.str(); }