Plug memory leak in xaccSplitDestroy

Splits were not marked for deletion if the transaction is read-only
and the account is not marked for deletion yet. The net result is
that split will not be freed later on.
However xaccSplitDestroy is also called from a Transaction's do_destroy.
At that point accounts are not necessarily marked for deletion yet (like
is the case when a datafile is closed). This turned out to be a problem
for invoice post transactions (which are also read only) and hence
would cause memory to leak.
This commit is contained in:
Geert Janssens 2018-09-10 18:57:39 +02:00
parent 196decf649
commit b866d7d955

View File

@ -1447,6 +1447,7 @@ xaccSplitDestroy (Split *split)
acc = split->acc;
trans = split->parent;
if (acc && !qof_instance_get_destroying(acc)
&& !qof_instance_get_destroying(trans)
&& xaccTransGetReadOnly(trans))
return FALSE;