diff options
author | John Wiegley <johnw@newartisans.com> | 2008-07-22 21:58:00 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-07-22 21:58:00 -0400 |
commit | 14de0694a95ecd494d5d45f91e30ab9bee06182a (patch) | |
tree | 3f3ac0cca20e7274b7dfe2013c7a4834a5297dc4 /valexpr.cc | |
parent | f0f2b34ea9db64bdabe65119d3fd265308e6d205 (diff) | |
download | fork-ledger-14de0694a95ecd494d5d45f91e30ab9bee06182a.tar.gz fork-ledger-14de0694a95ecd494d5d45f91e30ab9bee06182a.tar.bz2 fork-ledger-14de0694a95ecd494d5d45f91e30ab9bee06182a.zip |
Fixed a memory bug due to a shallow copy in value_t::storage_t.
Diffstat (limited to 'valexpr.cc')
-rw-r--r-- | valexpr.cc | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -56,8 +56,11 @@ bool compute_amount(ptr_op_t expr, amount_t& amt, value_t result; try { expr->compute(result, xact ? details_t(*xact) : details_t(), context); - result.cast(value_t::AMOUNT); - amt = result.as_amount_lval(); + + // Most of the time when computing the amount of a transaction this cast + // will do nothing at all. + result.in_place_cast(value_t::AMOUNT); + amt = result.as_amount(); } catch (error * err) { if (err->context.empty() || |