[gnc-dense-cal] leaks in markdata and GTimer

- mark->name wasn't correctly freed
- don't unnecessarily allocate GTimer
This commit is contained in:
Christopher Lam 2022-07-30 13:39:34 +08:00
parent 45aac53952
commit accdf9e852

View File

@ -818,8 +818,10 @@ gdc_free_all_mark_data(GncDenseCal *dcal)
/* Remove the old mark data. */
for (l = dcal->markData; l; l = l->next)
{
g_list_free(((gdc_mark_data*)l->data)->ourMarks);
g_free((gdc_mark_data*)l->data);
gdc_mark_data *mark = l->data;
g_list_free (mark->ourMarks);
g_free (mark->name);
g_free (mark);
}
g_list_free(dcal->markData);
dcal->markData = NULL;
@ -902,13 +904,14 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
cairo_t *cr;
gchar *primary_color_class, *secondary_color_class, *marker_color_class;
timer = g_timer_new();
DEBUG("drawing");
widget = GTK_WIDGET(dcal);
if (!dcal->surface)
return;
timer = g_timer_new();
g_timer_start(timer);
cr = cairo_create (dcal->surface);
layout = gtk_widget_create_pango_layout(GTK_WIDGET(dcal), NULL);