Bugfix: Require OrderedTxItems to provide properly scoped accounting entry list

OrderedTxItems returns a multimap of pointers, but needs a place to store the actual CAccountingEntries it points to.
It had been using a stack item, which was clobbered as soon as it returned, resulting in undefined behaviour.
This fixes at least bug #1768.
This commit is contained in:
Luke Dashjr
2012-09-01 22:07:47 +00:00
parent c3f95ef13f
commit ddb709e9de
3 changed files with 12 additions and 6 deletions

View File

@@ -987,7 +987,8 @@ Value listtransactions(const Array& params, bool fHelp)
Array ret;
CWallet::TxItems txOrdered = pwalletMain->OrderedTxItems(strAccount);
std::list<CAccountingEntry> acentries;
CWallet::TxItems txOrdered = pwalletMain->OrderedTxItems(acentries, strAccount);
// iterate backwards until we have nCount items to return:
for (CWallet::TxItems::reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it)