[gnc-budget] g_value_unset GValue

This commit is contained in:
Christopher Lam 2021-06-05 00:20:23 +08:00
parent a6ecd30741
commit 3353d3950b

View File

@ -562,6 +562,7 @@ gnc_budget_is_account_period_value_set(const GncBudget *budget,
qof_instance_get_kvp (QOF_INSTANCE (budget), &v, 2, path_part_one, path_part_two);
if (G_VALUE_HOLDS_BOXED (&v))
ptr = g_value_get_boxed (&v);
g_value_unset (&v);
return (ptr != NULL);
}
@ -571,6 +572,7 @@ gnc_budget_get_account_period_value(const GncBudget *budget,
guint period_num)
{
gnc_numeric *numeric = NULL;
gnc_numeric retval;
gchar path_part_one [GUID_ENCODING_LENGTH + 1];
gchar path_part_two [GNC_BUDGET_MAX_NUM_PERIODS_DIGITS];
GValue v = G_VALUE_INIT;
@ -583,9 +585,9 @@ gnc_budget_get_account_period_value(const GncBudget *budget,
if (G_VALUE_HOLDS_BOXED (&v))
numeric = (gnc_numeric*)g_value_get_boxed (&v);
if (numeric)
return *numeric;
return gnc_numeric_zero();
retval = numeric ? *numeric : gnc_numeric_zero ();
g_value_unset (&v);
return retval;
}