mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Normalize memory handling of GncDenseCal marked-element "info" string.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15833 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
bda70ee100
commit
18f0e755ec
@ -289,7 +289,7 @@ gdcs_get_info(GncDenseCalModel *model, guint tag)
|
||||
{
|
||||
GncDenseCalStore *mdl = GNC_DENSE_CAL_STORE(model);
|
||||
// assert(tag == 1)
|
||||
return mdl->info;
|
||||
return g_strdup(mdl->info);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -1660,7 +1660,7 @@ gdc_add_tag_markings(GncDenseCal *cal, guint tag)
|
||||
num_marks = gnc_dense_cal_model_get_instance_count(cal->model, tag);
|
||||
|
||||
if (num_marks == 0)
|
||||
return;
|
||||
goto cleanup;
|
||||
|
||||
dates = g_new0(GDate*, num_marks);
|
||||
for (idx = 0; idx < num_marks; idx++)
|
||||
@ -1676,6 +1676,9 @@ gdc_add_tag_markings(GncDenseCal *cal, guint tag)
|
||||
g_date_free(dates[idx]);
|
||||
}
|
||||
g_free(dates);
|
||||
|
||||
cleanup:
|
||||
g_free(info);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1688,6 +1691,7 @@ gdc_add_markings(GncDenseCal *cal)
|
||||
guint tag = GPOINTER_TO_UINT(tags->data);
|
||||
gdc_add_tag_markings(cal, tag);
|
||||
}
|
||||
// @fixme: list cleanup
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1700,6 +1704,7 @@ gdc_remove_markings(GncDenseCal *cal)
|
||||
guint tag = GPOINTER_TO_UINT(tags->data);
|
||||
gdc_mark_remove(cal, tag);
|
||||
}
|
||||
// @fixme: list cleanup
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -206,7 +206,6 @@ gsidca_get_info(GncDenseCalModel *model, guint tag)
|
||||
// g_list_find(instances->sxes, {sx_to_tag, tag}).get_freq_spec().get_freq_str();
|
||||
FreqSpec *spec;
|
||||
GString *info;
|
||||
gchar *info_str;
|
||||
GncSxInstances *insts
|
||||
= (GncSxInstances*)g_list_find_custom(adapter->instances->sx_instance_list, GUINT_TO_POINTER(tag), gsidca_find_sx_with_tag)->data;
|
||||
if (insts == NULL)
|
||||
@ -214,9 +213,7 @@ gsidca_get_info(GncDenseCalModel *model, guint tag)
|
||||
spec = xaccSchedXactionGetFreqSpec(insts->sx);
|
||||
info = g_string_sized_new(16);
|
||||
xaccFreqSpecGetFreqStr(spec, info);
|
||||
info_str = info->str; // @fixme leaked... :/
|
||||
g_string_free(info, FALSE);
|
||||
return info_str;
|
||||
return g_string_free(info, FALSE);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
Loading…
Reference in New Issue
Block a user