From 802c1eb462ee1c5fe2ae471e48e26b0c3b6d9a67 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 5 Sep 2010 22:33:01 +0200 Subject: [PATCH] Always allocate and free formatted dates in history panel --- panels/midori-history.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/panels/midori-history.c b/panels/midori-history.c index 17f79e3d..0ccf7950 100644 --- a/panels/midori-history.c +++ b/panels/midori-history.c @@ -136,21 +136,21 @@ midori_history_format_date (KatzeItem *item) /* A negative age is a date in the future, the clock is probably off */ if (age < -1) - ; + sdate = g_strdup (""); else if (age > 7 || age < 0) { strftime (token, sizeof (token), "%x", localtime ((time_t*)&day)); sdate = g_strdup (token); } else if (age > 6) - sdate = _("A week ago"); + sdate = g_strdup (_("A week ago")); else if (age > 1) sdate = g_strdup_printf (ngettext ("%d day ago", "%d days ago", (gint)age), (gint)age); else if (age == 0) - sdate = _("Today"); + sdate = g_strdup (_("Today")); else - sdate = _("Yesterday"); + sdate = g_strdup (_("Yesterday")); return sdate; } @@ -563,8 +563,11 @@ midori_history_treeview_render_text_cb (GtkTreeViewColumn* column, g_object_set (renderer, "markup", NULL, "text", katze_item_get_name (item), NULL); else if (KATZE_ITEM_IS_FOLDER (item)) - g_object_set (renderer, "markup", NULL, - "text", midori_history_format_date (item), NULL); + { + gchar* formatted = midori_history_format_date (item); + g_object_set (renderer, "markup", NULL, "text", formatted, NULL); + g_free (formatted); + } else g_object_set (renderer, "markup", _("Separator"), NULL); -- 2.39.5