From bf923ab33e9951d25611cb7193d6852e9113d929 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 19 Aug 2004 03:28:48 -0400 Subject: use std::auto_ptr wherever a thrown exception might otherwise leak memory --- walk.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'walk.cc') diff --git a/walk.cc b/walk.cc index 908618b5..8b9f3874 100644 --- a/walk.cc +++ b/walk.cc @@ -90,12 +90,11 @@ void changed_value_transactions::operator()(transaction_t * xact) if (balance_t diff = cur_bal - prev_bal) { entry_t * entry = new entry_t; + entry_temps.push_back(entry); entry->payee = "Commodities revalued"; entry->date = current; - entry_temps.push_back(entry); - for (amounts_map::const_iterator i = diff.amounts.begin(); i != diff.amounts.end(); i++) { @@ -138,10 +137,10 @@ void subtotal_transactions::flush(const char * spec_fmt) } entry_t * entry = new entry_t; - entry->payee = buf; - entry_temps.push_back(entry); + entry->payee = buf; + for (balances_map::iterator i = balances.begin(); i != balances.end(); i++) { -- cgit v1.2.3