Fix MS15574: Tiny memory leak in Wallet.h

This commit is contained in:
Zach Fox 2018-06-04 14:13:25 -07:00
parent 64cccc55d4
commit 7407507f0b
2 changed files with 3 additions and 1 deletions

View file

@ -314,6 +314,7 @@ Wallet::Wallet() {
auto nodeList = DependencyManager::get<NodeList>();
auto ledger = DependencyManager::get<Ledger>();
auto& packetReceiver = nodeList->getPacketReceiver();
_passphrase = new QString("");
packetReceiver.registerListener(PacketType::ChallengeOwnership, this, "handleChallengeOwnershipPacket");
packetReceiver.registerListener(PacketType::ChallengeOwnershipRequest, this, "handleChallengeOwnershipPacket");
@ -359,6 +360,7 @@ void Wallet::clear() {
// tell the provider we got nothing
updateImageProvider();
_passphrase->clear();
delete _passphrase;
}
Wallet::~Wallet() {

View file

@ -78,7 +78,7 @@ private:
QByteArray _salt;
QByteArray _iv;
QByteArray _ckey;
QString* _passphrase { new QString("") };
QString* _passphrase { nullptr };
bool _isOverridingServer { false };
bool writeWallet(const QString& newPassphrase = QString(""));