Fix memory leaks logging with gnc_numeric_to_string()

The value returned by gnc_numeric_to_string() needs to be freed.
Use gnc_num_dbg_to_string() instead.
This commit is contained in:
Simon Arlott
2023-06-28 08:16:20 +01:00
parent dbf8f93be4
commit 663dfadb90
3 changed files with 14 additions and 7 deletions

View File

@@ -1271,8 +1271,15 @@ xaccSplitSetValue (Split *s, gnc_numeric amt)
GNC_HOW_RND_ROUND_HALF_UP);
if (gnc_numeric_check(new_val) == GNC_ERROR_OK &&
!(gnc_numeric_zero_p (new_val) && !gnc_numeric_zero_p (amt)))
{
s->value = new_val;
else PERR("numeric error %s in converting the split value's denominator with amount %s and denom %d", gnc_numeric_errorCode_to_string(gnc_numeric_check(new_val)), gnc_numeric_to_string(amt), get_currency_denom(s));
}
else
{
PERR("numeric error %s in converting the split value's denominator with amount %s and denom %d",
gnc_numeric_errorCode_to_string(gnc_numeric_check(new_val)),
gnc_num_dbg_to_string (amt), get_currency_denom(s));
}
SET_GAINS_VDIRTY(s);
mark_split (s);