aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-11-17 13:05:54 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-11-17 13:07:37 +0100
commitf6f8d54aff344493ee8b642f8add3ccfcf914ae6 (patch)
tree995854f5406c51d650327726f43bdbf50919449f /src/qt
parent41221126c85524a6dec34a4f44cb5b74b1f12e64 (diff)
parent446e2610b0cd6535e623952bf22ea09ce0ed8aaf (diff)
Merge #10920: [qt] Fix potential memory leak in newPossibleKey(ChangeCWallet *wallet)
446e261 [qt] Fix potential memory leak in newPossibleKey(ChangeCWallet *wallet) (practicalswift) Pull request description: Fix potential memory leak in `newPossibleKey(ChangeCWallet *wallet)`. Tree-SHA512: 252d3828133a0d241cc649aed1280e14a5d5ea47b7b2989039cfa5061a8e35183c7f36d7320aa0ac1b4dcab31e584b358dbbb2fe645a412371d0a460878e2b58
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/walletmodeltransaction.cpp6
-rw-r--r--src/qt/walletmodeltransaction.h2
2 files changed, 3 insertions, 5 deletions
diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp
index 3bf3e295ff..2188b39b92 100644
--- a/src/qt/walletmodeltransaction.cpp
+++ b/src/qt/walletmodeltransaction.cpp
@@ -10,7 +10,6 @@
WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &_recipients) :
recipients(_recipients),
walletTransaction(0),
- keyChange(0),
fee(0)
{
walletTransaction = new CWalletTx();
@@ -18,7 +17,6 @@ WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &
WalletModelTransaction::~WalletModelTransaction()
{
- delete keyChange;
delete walletTransaction;
}
@@ -91,10 +89,10 @@ CAmount WalletModelTransaction::getTotalTransactionAmount() const
void WalletModelTransaction::newPossibleKeyChange(CWallet *wallet)
{
- keyChange = new CReserveKey(wallet);
+ keyChange.reset(new CReserveKey(wallet));
}
CReserveKey *WalletModelTransaction::getPossibleKeyChange()
{
- return keyChange;
+ return keyChange.get();
}
diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h
index d75875eefd..519cf9df99 100644
--- a/src/qt/walletmodeltransaction.h
+++ b/src/qt/walletmodeltransaction.h
@@ -40,7 +40,7 @@ public:
private:
QList<SendCoinsRecipient> recipients;
CWalletTx *walletTransaction;
- CReserveKey *keyChange;
+ std::unique_ptr<CReserveKey> keyChange;
CAmount fee;
};