diff options
author | John Wiegley <johnw@newartisans.com> | 2012-06-27 16:55:46 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-06-27 16:55:46 -0500 |
commit | 8869566331b5b95a43214157b3dd36ce076deee3 (patch) | |
tree | 865e59dc25435a7005540b6ac67c9af9e79b1183 /src/xact.cc | |
parent | cbf4cba18bd207917a24a8beb797ea773b3ad1ce (diff) | |
download | fork-ledger-8869566331b5b95a43214157b3dd36ce076deee3.tar.gz fork-ledger-8869566331b5b95a43214157b3dd36ce076deee3.tar.bz2 fork-ledger-8869566331b5b95a43214157b3dd36ce076deee3.zip |
Fixed a subtle memory overwrite
Fixes #608
Diffstat (limited to 'src/xact.cc')
-rw-r--r-- | src/xact.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/xact.cc b/src/xact.cc index b5cb2a38..a54da81a 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -355,14 +355,16 @@ bool xact_base_t::finalize() } } } else { - if (post->amount.has_annotation()) { - if (breakdown.amount.has_annotation()) - breakdown.amount.annotation().tag = post->amount.annotation().tag; - else - breakdown.amount.annotate - (annotation_t(none, none, post->amount.annotation().tag)); - } - post->amount = breakdown.amount; + post->amount = + breakdown.amount.has_annotation() ? + amount_t(breakdown.amount, + annotation_t(breakdown.amount.annotation().price, + breakdown.amount.annotation().date, + post->amount.has_annotation() ? + post->amount.annotation().tag : + breakdown.amount.annotation().tag, + breakdown.amount.annotation().value_expr)) : + breakdown.amount; DEBUG("xact.finalize", "added breakdown, balance = " << balance); } |