diff --git a/src/streams/SymmetricCipherStream.cpp b/src/streams/SymmetricCipherStream.cpp index 634d004b0..83a109138 100644 --- a/src/streams/SymmetricCipherStream.cpp +++ b/src/streams/SymmetricCipherStream.cpp @@ -21,11 +21,12 @@ SymmetricCipherStream::SymmetricCipherStream(QIODevice* baseDevice, SymmetricCip SymmetricCipher::Mode mode, SymmetricCipher::Direction direction, const QByteArray& key, const QByteArray& iv) : LayeredStream(baseDevice) + , m_cipher(new SymmetricCipher(algo, mode, direction, key, iv)) , m_bufferPos(0) , m_bufferFilling(false) , m_error(false) { - m_cipher = new SymmetricCipher(algo, mode, direction, key, iv); + } SymmetricCipherStream::~SymmetricCipherStream() diff --git a/src/streams/SymmetricCipherStream.h b/src/streams/SymmetricCipherStream.h index d4eee2e42..b236cf66e 100644 --- a/src/streams/SymmetricCipherStream.h +++ b/src/streams/SymmetricCipherStream.h @@ -19,6 +19,7 @@ #define KEEPASSX_SYMMETRICCIPHERSTREAM_H #include +#include #include "crypto/SymmetricCipher.h" #include "streams/LayeredStream.h" @@ -42,7 +43,7 @@ private: bool readBlock(); bool writeBlock(); - SymmetricCipher* m_cipher; + const QScopedPointer m_cipher; QByteArray m_buffer; int m_bufferPos; bool m_bufferFilling;