mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
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
This commit is contained in:
commit
f6f8d54aff
@ -10,7 +10,6 @@
|
|||||||
WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &_recipients) :
|
WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &_recipients) :
|
||||||
recipients(_recipients),
|
recipients(_recipients),
|
||||||
walletTransaction(0),
|
walletTransaction(0),
|
||||||
keyChange(0),
|
|
||||||
fee(0)
|
fee(0)
|
||||||
{
|
{
|
||||||
walletTransaction = new CWalletTx();
|
walletTransaction = new CWalletTx();
|
||||||
@ -18,7 +17,6 @@ WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &
|
|||||||
|
|
||||||
WalletModelTransaction::~WalletModelTransaction()
|
WalletModelTransaction::~WalletModelTransaction()
|
||||||
{
|
{
|
||||||
delete keyChange;
|
|
||||||
delete walletTransaction;
|
delete walletTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,10 +89,10 @@ CAmount WalletModelTransaction::getTotalTransactionAmount() const
|
|||||||
|
|
||||||
void WalletModelTransaction::newPossibleKeyChange(CWallet *wallet)
|
void WalletModelTransaction::newPossibleKeyChange(CWallet *wallet)
|
||||||
{
|
{
|
||||||
keyChange = new CReserveKey(wallet);
|
keyChange.reset(new CReserveKey(wallet));
|
||||||
}
|
}
|
||||||
|
|
||||||
CReserveKey *WalletModelTransaction::getPossibleKeyChange()
|
CReserveKey *WalletModelTransaction::getPossibleKeyChange()
|
||||||
{
|
{
|
||||||
return keyChange;
|
return keyChange.get();
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QList<SendCoinsRecipient> recipients;
|
QList<SendCoinsRecipient> recipients;
|
||||||
CWalletTx *walletTransaction;
|
CWalletTx *walletTransaction;
|
||||||
CReserveKey *keyChange;
|
std::unique_ptr<CReserveKey> keyChange;
|
||||||
CAmount fee;
|
CAmount fee;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user