diff --git a/ChangeLog b/ChangeLog index 7a698a8d65..1e67e91168 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-01-23 Derek Atkins + + * src/business/business-core/gncInvoice.c: Properly accumulate + splits (bug #165053). Also fixes a (related) memory leak + (caused by the same lack-of-reference to accumulated splits). + 2005-01-16 Christian Stimming * src/app-utils/gnc-ui-util.c: Modify tax option code to load diff --git a/src/business/business-core/gncInvoice.c b/src/business/business-core/gncInvoice.c index 3ab24483aa..0224120c88 100644 --- a/src/business/business-core/gncInvoice.c +++ b/src/business/business-core/gncInvoice.c @@ -855,23 +855,23 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc, if (this_acc) { if (gnc_numeric_check (value) == GNC_ERROR_OK) { if (accumulatesplits) { - gncAccountValueAdd (splitinfo, this_acc, value); + splitinfo = gncAccountValueAdd (splitinfo, this_acc, value); } else { - Split *split; + Split *split; - split = xaccMallocSplit (invoice->inst.book); - /* set action and memo? */ + split = xaccMallocSplit (invoice->inst.book); + /* set action and memo? */ - xaccSplitSetMemo (split, gncEntryGetDescription (entry)); - xaccSplitSetAction (split, type); + xaccSplitSetMemo (split, gncEntryGetDescription (entry)); + xaccSplitSetAction (split, type); - xaccSplitSetBaseValue (split, (reverse ? gnc_numeric_neg (value) - : value), + xaccSplitSetBaseValue (split, (reverse ? gnc_numeric_neg (value) + : value), invoice->currency); - xaccAccountBeginEdit (this_acc); - xaccAccountInsertSplit (this_acc, split); - xaccAccountCommitEdit (this_acc); - xaccTransAppendSplit (txn, split); + xaccAccountBeginEdit (this_acc); + xaccAccountInsertSplit (this_acc, split); + xaccAccountCommitEdit (this_acc); + xaccTransAppendSplit (txn, split); } /* If there is a credit-card account, and this is a CCard