summaryrefslogtreecommitdiff
path: root/src/value.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-21 03:48:02 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-21 03:48:02 -0400
commitaeea1cb3e1c5c158294e1f08543065c2e602c94e (patch)
tree6faa36fab7bd2c2c2b04046a493a60e0ca9eee6b /src/value.h
parent5d50d895bf4aaa139c4b632820b661de383b2ef3 (diff)
downloadfork-ledger-aeea1cb3e1c5c158294e1f08543065c2e602c94e.tar.gz
fork-ledger-aeea1cb3e1c5c158294e1f08543065c2e602c94e.tar.bz2
fork-ledger-aeea1cb3e1c5c158294e1f08543065c2e602c94e.zip
Fixed a memory leak in value_t::storage_t
Diffstat (limited to 'src/value.h')
-rw-r--r--src/value.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/value.h b/src/value.h
index 3a052fb2..5fb78cb4 100644
--- a/src/value.h
+++ b/src/value.h
@@ -166,19 +166,8 @@ private:
*/
~storage_t() {
TRACE_DTOR(value_t::storage_t);
- DEBUG("value.storage.refcount", "Destroying " << this);
assert(refc == 0);
-
- switch (type) {
- case BALANCE:
- checked_delete(boost::get<balance_t *>(data));
- break;
- case SEQUENCE:
- checked_delete(boost::get<sequence_t *>(data));
- break;
- default:
- break;
- }
+ destroy();
}
private:
@@ -218,6 +207,21 @@ private:
friend inline void intrusive_ptr_release(value_t::storage_t * storage) {
storage->release();
}
+
+ void destroy() {
+ DEBUG("value.storage.refcount", "Destroying " << this);
+ switch (type) {
+ case BALANCE:
+ checked_delete(boost::get<balance_t *>(data));
+ break;
+ case SEQUENCE:
+ checked_delete(boost::get<sequence_t *>(data));
+ break;
+ default:
+ break;
+ }
+ type = VOID;
+ }
};
/**