summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/report.cc b/src/report.cc
index 1adbe9d0..c4f916d7 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -469,8 +469,20 @@ void report_t::commodities_report(post_handler_ptr handler)
{
handler = chain_handlers(handler, *this);
- posts_commodities_iterator walker(*session.journal.get());
- pass_down_posts<posts_commodities_iterator>(handler, walker);
+ posts_commodities_iterator * walker(new posts_commodities_iterator(*session.journal.get()));
+ try {
+ pass_down_posts<posts_commodities_iterator>(handler, *walker);
+ }
+ catch (...) {
+#if defined(VERIFY_ON)
+ IF_VERIFY() {
+ // If --verify was used, clean up the posts_commodities_iterator.
+ // Otherwise, just leak like a sieve.
+ checked_delete(walker);
+ }
+#endif
+ throw;
+ }
session.journal->clear_xdata();
}