aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpracticalswift <[email protected]>2017-08-07 14:28:40 +0200
committerpracticalswift <[email protected]>2017-08-07 16:42:20 +0200
commit446e2610b0cd6535e623952bf22ea09ce0ed8aaf (patch)
tree1499b33127a60dcdb6fb9fc0c17394d86469edc7 /src
parentMerge #9622: [rpc] listsinceblock should include lost transactions when param... (diff)
downloaddiscoin-446e2610b0cd6535e623952bf22ea09ce0ed8aaf.tar.xz
discoin-446e2610b0cd6535e623952bf22ea09ce0ed8aaf.zip
[qt] Fix potential memory leak in newPossibleKey(ChangeCWallet *wallet)
Diffstat (limited to 'src')
-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 8bc9ef725..c74db93a0 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()
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 64922efad..5ef533421 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;
};