mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-26 02:40:43 -06:00
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:
parent
dbf8f93be4
commit
663dfadb90
@ -474,9 +474,9 @@ check_credit_debit_balance (gpointer key, gpointer val, gpointer ud)
|
||||
*unbalanced |= !(gnc_numeric_zero_p (diff));
|
||||
|
||||
DEBUG ("%p | %s [%s - %s = %s]", key, result,
|
||||
gnc_numeric_to_string (tcds->debitSum),
|
||||
gnc_numeric_to_string (tcds->creditSum),
|
||||
gnc_numeric_to_string (diff));
|
||||
gnc_num_dbg_to_string (tcds->debitSum),
|
||||
gnc_num_dbg_to_string (tcds->creditSum),
|
||||
gnc_num_dbg_to_string (diff));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1141,7 +1141,7 @@ split_apply_exchange_rate (Split *split, GHashTable *bindings,
|
||||
if (exchange_rate_var != NULL)
|
||||
{
|
||||
exchange_rate = exchange_rate_var->value;
|
||||
DEBUG("exchange_rate is %s", gnc_numeric_to_string (exchange_rate));
|
||||
DEBUG("exchange_rate is %s", gnc_num_dbg_to_string (exchange_rate));
|
||||
}
|
||||
g_free (exchange_rate_var_name);
|
||||
|
||||
@ -1154,7 +1154,7 @@ split_apply_exchange_rate (Split *split, GHashTable *bindings,
|
||||
GNC_HOW_RND_ROUND_HALF_UP);
|
||||
|
||||
|
||||
DEBUG("amount is %s for memo split '%s'", gnc_numeric_to_string (amt),
|
||||
DEBUG("amount is %s for memo split '%s'", gnc_num_dbg_to_string (amt),
|
||||
xaccSplitGetMemo (split));
|
||||
xaccSplitSetAmount(split, amt); /* marks split dirty */
|
||||
|
||||
@ -1318,7 +1318,7 @@ create_each_transaction_helper(Transaction *template_txn, void *user_data)
|
||||
creation_data);
|
||||
xaccSplitSetValue(copying_split, final);
|
||||
DEBUG("value is %s for memo split '%s'",
|
||||
gnc_numeric_to_string (final),
|
||||
gnc_num_dbg_to_string (final),
|
||||
xaccSplitGetMemo (copying_split));
|
||||
if (! gnc_commodity_equal(split_cmdty, txn_cmdty))
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user