summaryrefslogtreecommitdiff
path: root/ledger.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ledger.cc')
-rw-r--r--ledger.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/ledger.cc b/ledger.cc
index de53b7b2..2b80642c 100644
--- a/ledger.cc
+++ b/ledger.cc
@@ -8,6 +8,8 @@ namespace ledger {
const std::string version = "2.0b";
+#ifdef DO_CLEANUP
+
journal_t::~journal_t()
{
DEBUG_PRINT("ledger.memory.dtors", "dtor journal_t");
@@ -20,9 +22,16 @@ journal_t::~journal_t()
for (entries_list::iterator i = entries.begin();
i != entries.end();
i++)
- delete *i;
+ if (! item_pool ||
+ ((char *) *i) < item_pool || ((char *) *i) >= item_pool_end)
+ delete *i;
+
+ if (item_pool)
+ delete[] item_pool;
}
+#endif // DO_CLEANUP
+
bool journal_t::add_entry(entry_t * entry)
{
entries.push_back(entry);