Fixed a memory leak that would show up if --verify --verbose was running and
an error or exception occurred.
This commit is contained in:
parent
c9d575abce
commit
ba02f0a450
4 changed files with 34 additions and 8 deletions
|
|
@ -122,11 +122,23 @@ class account_t : public scope_t
|
|||
: supports_flags<>(), count(0), total_count(0),
|
||||
virtuals(0), dflags(0)
|
||||
{
|
||||
TRACE_CTOR(xdata_t, "");
|
||||
TRACE_CTOR(account_t::xdata_t, "");
|
||||
}
|
||||
xdata_t(const xdata_t& other)
|
||||
: supports_flags<>(other.flags()),
|
||||
value(other.value),
|
||||
total(other.total),
|
||||
sort_value(other.sort_value),
|
||||
count(other.count),
|
||||
total_count(other.total_count),
|
||||
virtuals(other.virtuals),
|
||||
dflags(other.dflags)
|
||||
{
|
||||
TRACE_CTOR(account_t::xdata_t, "copy");
|
||||
}
|
||||
|
||||
~xdata_t() throw() {
|
||||
TRACE_DTOR(xdata_t);
|
||||
TRACE_DTOR(account_t::xdata_t);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -45,9 +45,12 @@ public:
|
|||
supports_flags() : flags_(0) {
|
||||
TRACE_CTOR(supports_flags, "");
|
||||
}
|
||||
supports_flags(const flags_t& arg) : flags_(arg) {
|
||||
supports_flags(const supports_flags& arg) : flags_(arg.flags_) {
|
||||
TRACE_CTOR(supports_flags, "copy");
|
||||
}
|
||||
supports_flags(const flags_t& arg) : flags_(arg) {
|
||||
TRACE_CTOR(supports_flags, "const flags_t&");
|
||||
}
|
||||
~supports_flags() throw() {
|
||||
TRACE_DTOR(supports_flags);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -566,9 +566,7 @@ int main(int argc, char * argv[], char * envp[])
|
|||
|
||||
status = read_and_report(*session->current_report.get(), argc, argv, envp);
|
||||
|
||||
if (DO_VERIFY())
|
||||
ledger::set_session_context();
|
||||
else
|
||||
if (! DO_VERIFY())
|
||||
session.release(); // don't free anything! just let it leak
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
|
|
@ -582,6 +580,7 @@ int main(int argc, char * argv[], char * envp[])
|
|||
|
||||
IF_VERIFY() {
|
||||
INFO("Ledger ended (Boost/libstdc++ may still hold memory)");
|
||||
ledger::set_session_context();
|
||||
ledger::shutdown_memory_tracing();
|
||||
} else {
|
||||
INFO("Ledger ended");
|
||||
|
|
|
|||
16
src/xact.h
16
src/xact.h
|
|
@ -155,10 +155,22 @@ public:
|
|||
optional<xacts_list> component_xacts;
|
||||
|
||||
xdata_t() : supports_flags<>(), index(0), account(NULL), ptr(NULL) {
|
||||
TRACE_CTOR(xdata_t, "");
|
||||
TRACE_CTOR(xact_t::xdata_t, "");
|
||||
}
|
||||
xdata_t(const xdata_t& other)
|
||||
: supports_flags<>(other.flags()),
|
||||
total(other.total),
|
||||
sort_value(other.sort_value),
|
||||
value(other.value),
|
||||
index(other.index),
|
||||
date(other.date),
|
||||
account(other.account),
|
||||
ptr(NULL)
|
||||
{
|
||||
TRACE_CTOR(xact_t::xdata_t, "copy");
|
||||
}
|
||||
~xdata_t() throw() {
|
||||
TRACE_DTOR(xdata_t);
|
||||
TRACE_DTOR(xact_t::xdata_t);
|
||||
}
|
||||
|
||||
void remember_xact(xact_t& xact) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue