Fix memory leak in SymmetricCipherStream.

This commit is contained in:
Felix Geyer 2012-04-22 22:26:05 +02:00
parent f9abf2171b
commit 7063f5296a
2 changed files with 4 additions and 2 deletions

View File

@ -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()

View File

@ -19,6 +19,7 @@
#define KEEPASSX_SYMMETRICCIPHERSTREAM_H
#include <QtCore/QByteArray>
#include <QtCore/QScopedPointer>
#include "crypto/SymmetricCipher.h"
#include "streams/LayeredStream.h"
@ -42,7 +43,7 @@ private:
bool readBlock();
bool writeBlock();
SymmetricCipher* m_cipher;
const QScopedPointer<SymmetricCipher> m_cipher;
QByteArray m_buffer;
int m_bufferPos;
bool m_bufferFilling;