From fb1c9fcb9b5b400ba0b94e942e8033b66d6c3162 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 10 Sep 2001 22:48:52 +0000 Subject: Purification. * e-summary.c (destroy): free the protocol hash. * e-summary-rdf.c (tree_walk): plug a leak. * e-summary-weather.c (e_summary_weather_init_locations): Don't insert duplicates into the hash table. * e-summary-mail.c (e_summary_mail_generate_html): free old html before setting new * e-summary.c (e_summary_draw): free weather and rdf html strings. * e-summary-preferences.c (save_known_rdfs): free strings. svn path=/trunk/; revision=12747 --- my-evolution/ChangeLog | 18 ++++++++++++++++++ my-evolution/e-summary-mail.c | 1 + my-evolution/e-summary-preferences.c | 1 + my-evolution/e-summary-rdf.c | 14 +++++--------- my-evolution/e-summary-weather.c | 10 ++++++---- my-evolution/e-summary.c | 14 ++++++++++++++ 6 files changed, 45 insertions(+), 13 deletions(-) diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index 7d6332efb8..87300a8b98 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,21 @@ +2001-09-10 Dan Winship + + Purification. + + * e-summary.c (destroy): free the protocol hash. + + * e-summary-rdf.c (tree_walk): plug a leak. + + * e-summary-weather.c (e_summary_weather_init_locations): Don't + insert duplicates into the hash table. + + * e-summary-mail.c (e_summary_mail_generate_html): free old html + before setting new + + * e-summary.c (e_summary_draw): free weather and rdf html strings. + + * e-summary-preferences.c (save_known_rdfs): free strings. + 2001-09-10 Iain Holmes * e-summary-preferences.c: Add Memepool RDF. diff --git a/my-evolution/e-summary-mail.c b/my-evolution/e-summary-mail.c index 624b2b3c60..71ab1c6cfa 100644 --- a/my-evolution/e-summary-mail.c +++ b/my-evolution/e-summary-mail.c @@ -120,6 +120,7 @@ e_summary_mail_generate_html (ESummary *summary) } g_string_append (string, ""); + g_free (mail->html); mail->html = string->str; g_string_free (string, FALSE); } diff --git a/my-evolution/e-summary-preferences.c b/my-evolution/e-summary-preferences.c index d0193cc47f..e933551ea8 100644 --- a/my-evolution/e-summary-preferences.c +++ b/my-evolution/e-summary-preferences.c @@ -504,6 +504,7 @@ save_known_rdfs (GList *rdfs) info = rdfs->data; line = g_strconcat (info->url, ",", info->name, "\n", NULL); fputs (line, handle); + g_free (line); } fclose (handle); diff --git a/my-evolution/e-summary-rdf.c b/my-evolution/e-summary-rdf.c index 24c8de3cc6..abc4f918c3 100644 --- a/my-evolution/e-summary-rdf.c +++ b/my-evolution/e-summary-rdf.c @@ -116,17 +116,17 @@ layer_find_url (xmlNodePtr node, if (*r == ' ') r++; /* Fix UF bug */ while (*r) { - if (memcmp (r, "&", 5) == 0) { + if (strncmp (r, "&", 5) == 0) { *w++ = '&'; r += 5; continue; } - if (memcmp (r, "<", 4) == 0) { + if (strncmp (r, "<", 4) == 0) { *w++ = '<'; r += 4; continue; } - if (memcmp (r, ">", 4) == 0) { + if (strncmp (r, ">", 4) == 0) { *w++ = '>'; r += 4; continue; @@ -229,12 +229,8 @@ tree_walk (xmlNodePtr root, t = layer_find(channel->childs, "title", ""); u = layer_find(channel->childs, "link", ""); - if (*u != '\0') { - char *full; - - full = g_strdup_printf ("", u); - g_string_append (html, full); - } + if (*u != '\0') + g_string_sprintfa (html, "", u); t = e_utf8_from_locale_string (t); g_string_append (html, t); g_free (t); diff --git a/my-evolution/e-summary-weather.c b/my-evolution/e-summary-weather.c index e1aa113095..6456d2a2ea 100644 --- a/my-evolution/e-summary-weather.c +++ b/my-evolution/e-summary-weather.c @@ -445,10 +445,12 @@ e_summary_weather_init_locations (void) &locdata); g_return_val_if_fail (nlocdata == 4, FALSE); - location = weather_location_new (locdata); - g_hash_table_insert (locations_hash, - g_strdup (locdata[1]), - location); + if (!g_hash_table_lookup (locations_hash, locdata[1])) { + location = weather_location_new (locdata); + g_hash_table_insert (locations_hash, + g_strdup (locdata[1]), + location); + } g_strfreev (locdata); } diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c index 8d816617b9..0df4dc3bc1 100644 --- a/my-evolution/e-summary.c +++ b/my-evolution/e-summary.c @@ -85,6 +85,13 @@ typedef struct _ProtocolListener { } ProtocolListener; +static void +free_protocol (gpointer key, gpointer value, gpointer user_data) +{ + g_free (key); + g_free (value); +} + static void destroy (GtkObject *object) { @@ -117,6 +124,11 @@ destroy (GtkObject *object) alarm_remove (priv->alarm); alarm_done (); + if (priv->protocol_hash) { + g_hash_table_foreach (priv->protocol_hash, free_protocol, NULL); + g_hash_table_destroy (priv->protocol_hash); + } + g_free (priv); summary->priv = NULL; @@ -155,11 +167,13 @@ e_summary_draw (ESummary *summary) html = e_summary_weather_get_html (summary); if (html != NULL) { g_string_append (string, html); + g_free (html); } html = e_summary_rdf_get_html (summary); if (html != NULL) { g_string_append (string, html); + g_free (html); } g_string_append (string, HTML_4); -- cgit v1.2.3