aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-medium.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-02-24 05:04:30 +0800
committerDan Winship <danw@src.gnome.org>2000-02-24 05:04:30 +0800
commite4842dc1b18a24d2e268f0e40d1329f6cb739753 (patch)
tree62b7ed8b1dda30042c5de4dd941df56b93d4f2f7 /camel/camel-medium.c
parent721f78b320ad2ac3064fd4102d244f30a74cf255 (diff)
downloadgsoc2013-evolution-e4842dc1b18a24d2e268f0e40d1329f6cb739753.tar
gsoc2013-evolution-e4842dc1b18a24d2e268f0e40d1329f6cb739753.tar.gz
gsoc2013-evolution-e4842dc1b18a24d2e268f0e40d1329f6cb739753.tar.bz2
gsoc2013-evolution-e4842dc1b18a24d2e268f0e40d1329f6cb739753.tar.lz
gsoc2013-evolution-e4842dc1b18a24d2e268f0e40d1329f6cb739753.tar.xz
gsoc2013-evolution-e4842dc1b18a24d2e268f0e40d1329f6cb739753.tar.zst
gsoc2013-evolution-e4842dc1b18a24d2e268f0e40d1329f6cb739753.zip
Free the data in the headers hash table. (_add_header): g_strdup the
* camel-medium.c (_finalize): Free the data in the headers hash table. (_add_header): g_strdup the header name and value when adding it. * camel-mime-part-utils.c (camel_mime_part_construct_headers_from_stream): Free the header data after calling camel_medium_add_header, since it will have g_strdup()ed it itself. svn path=/trunk/; revision=1913
Diffstat (limited to 'camel/camel-medium.c')
-rw-r--r--camel/camel-medium.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/camel/camel-medium.c b/camel/camel-medium.c
index a381319063..1410545c5e 100644
--- a/camel/camel-medium.c
+++ b/camel/camel-medium.c
@@ -111,6 +111,13 @@ camel_medium_get_type (void)
}
+static void
+_free_header (gpointer key, gpointer value, gpointer data)
+{
+ g_free (key);
+ g_free (value);
+}
+
static void
_finalize (GtkObject *object)
{
@@ -120,7 +127,7 @@ _finalize (GtkObject *object)
CAMEL_LOG_FULL_DEBUG ("Entering CamelMedium::finalize\n");
if (medium->headers) {
-#warning Free hash table elements
+ g_hash_table_foreach (medium->headers, _free_header, NULL);
g_hash_table_destroy (medium->headers);
}
@@ -148,7 +155,8 @@ _add_header (CamelMedium *medium, gchar *header_name, gchar *header_value)
g_free (old_header_value);
}
- g_hash_table_insert (medium->headers, header_name, header_value);
+ g_hash_table_insert (medium->headers, g_strdup (header_name),
+ g_strdup (header_value));
}