aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-09-11 06:48:52 +0800
committerDan Winship <danw@src.gnome.org>2001-09-11 06:48:52 +0800
commitfb1c9fcb9b5b400ba0b94e942e8033b66d6c3162 (patch)
tree7291c70eb42ef7480885bc968023478ae2a0685f
parentb5297de4c44a76856bd3e0385bd8ba36a40c18d1 (diff)
downloadgsoc2013-evolution-fb1c9fcb9b5b400ba0b94e942e8033b66d6c3162.tar.gz
gsoc2013-evolution-fb1c9fcb9b5b400ba0b94e942e8033b66d6c3162.tar.zst
gsoc2013-evolution-fb1c9fcb9b5b400ba0b94e942e8033b66d6c3162.zip
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
-rw-r--r--my-evolution/ChangeLog18
-rw-r--r--my-evolution/e-summary-mail.c1
-rw-r--r--my-evolution/e-summary-preferences.c1
-rw-r--r--my-evolution/e-summary-rdf.c14
-rw-r--r--my-evolution/e-summary-weather.c10
-rw-r--r--my-evolution/e-summary.c14
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 <danw@ximian.com>
+
+ 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 <iain@ximian.com>
* 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, "</table></dd></dl>");
+ 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, "&amp;", 5) == 0) {
+ if (strncmp (r, "&amp;", 5) == 0) {
*w++ = '&';
r += 5;
continue;
}
- if (memcmp (r, "&lt;", 4) == 0) {
+ if (strncmp (r, "&lt;", 4) == 0) {
*w++ = '<';
r += 4;
continue;
}
- if (memcmp (r, "&gt;", 4) == 0) {
+ if (strncmp (r, "&gt;", 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 ("<a href=\"%s\">", u);
- g_string_append (html, full);
- }
+ if (*u != '\0')
+ g_string_sprintfa (html, "<a href=\"%s\">", 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
@@ -86,6 +86,13 @@ typedef struct _ProtocolListener {
static void
+free_protocol (gpointer key, gpointer value, gpointer user_data)
+{
+ g_free (key);
+ g_free (value);
+}
+
+static void
destroy (GtkObject *object)
{
ESummary *summary;
@@ -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);