summaryrefslogtreecommitdiff
path: root/valexpr.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-22 21:58:00 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-22 21:58:00 -0400
commit14de0694a95ecd494d5d45f91e30ab9bee06182a (patch)
tree3f3ac0cca20e7274b7dfe2013c7a4834a5297dc4 /valexpr.cc
parentf0f2b34ea9db64bdabe65119d3fd265308e6d205 (diff)
downloadfork-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.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/valexpr.cc b/valexpr.cc
index 16f43a15..509c6fa1 100644
--- a/valexpr.cc
+++ b/valexpr.cc
@@ -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() ||