From 14de0694a95ecd494d5d45f91e30ab9bee06182a Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 22 Jul 2008 21:58:00 -0400 Subject: Fixed a memory bug due to a shallow copy in value_t::storage_t. --- valexpr.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'valexpr.cc') 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() || -- cgit v1.2.3