mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
fix how transaction freeing works.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@731 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
33dcb12eae
commit
0235cba2e3
@ -92,13 +92,19 @@ xaccMallocSplit( void )
|
|||||||
void
|
void
|
||||||
xaccFreeSplit( Split *split )
|
xaccFreeSplit( Split *split )
|
||||||
{
|
{
|
||||||
|
Transaction *trans;
|
||||||
|
|
||||||
if (!split) return;
|
if (!split) return;
|
||||||
|
|
||||||
/* free a split only if it is not claimed
|
/* free a split only if it is not claimed
|
||||||
* by any accounts. */
|
* by any accounts. */
|
||||||
if (split->acc) return;
|
if (split->acc) return;
|
||||||
|
|
||||||
xaccTransRemoveSplit (split->parent, split);
|
/* free the split only if its not a source split */
|
||||||
|
trans = split->parent;
|
||||||
|
if (&(trans->source_split) == split) return;
|
||||||
|
|
||||||
|
xaccTransRemoveSplit (trans, split);
|
||||||
|
|
||||||
free(split->memo);
|
free(split->memo);
|
||||||
free(split->action);
|
free(split->action);
|
||||||
@ -255,7 +261,30 @@ xaccFreeTransaction( Transaction *trans )
|
|||||||
s = trans->dest_splits[i];
|
s = trans->dest_splits[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* free up the destination splits */
|
||||||
|
i = 0;
|
||||||
|
s = trans->dest_splits[i];
|
||||||
|
while (s) {
|
||||||
|
xaccFreeSplit (s);
|
||||||
|
i++;
|
||||||
|
s = trans->dest_splits[i];
|
||||||
|
}
|
||||||
|
|
||||||
_free (trans->dest_splits);
|
_free (trans->dest_splits);
|
||||||
|
|
||||||
|
|
||||||
|
/* free up the source-split related stuff. */
|
||||||
|
free(trans->source_split.memo);
|
||||||
|
free(trans->source_split.action);
|
||||||
|
|
||||||
|
/* just in case someone looks up freed memory ... */
|
||||||
|
trans->source_split.memo = 0x0;
|
||||||
|
trans->source_split.reconciled = NREC;
|
||||||
|
trans->source_split.damount = 0.0;
|
||||||
|
trans->source_split.share_price = 1.0;
|
||||||
|
trans->source_split.parent = NULL;
|
||||||
|
|
||||||
|
/* free up transaction strings */
|
||||||
free(trans->num);
|
free(trans->num);
|
||||||
free(trans->description);
|
free(trans->description);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user