Fixed a subtle memory overwrite

Fixes #608
This commit is contained in:
John Wiegley 2012-06-27 16:55:46 -05:00
parent cbf4cba18b
commit 8869566331

View file

@ -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);
}