diff options
-rw-r--r-- | camel/ChangeLog | 11 | ||||
-rw-r--r-- | camel/camel-medium.c | 12 | ||||
-rw-r--r-- | camel/camel-mime-part-utils.c | 9 |
3 files changed, 26 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 619c4743c3..67e0a67776 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,14 @@ +2000-02-23 Dan Winship <danw@helixcode.com> + + * 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. + 2000-02-22 NotZed <NotZed@HelixCode.com> * providers/mbox/camel-mbox-search.c: Dont compile by default. 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)); } diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index 6a06bc3bce..fe3c175cb3 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -65,12 +65,13 @@ camel_mime_part_construct_headers_from_stream (CamelMimePart *mime_part, camel_medium_add_header ( CAMEL_MEDIUM (mime_part), cur_header->name, cur_header->value); - } + g_free (cur_header->name); + g_free (cur_header->value); + } - g_array_free (header_array, TRUE); + g_array_free (header_array, TRUE); - CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_headers_from_stream " - "headers parsed. Leaving \n"); + CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_headers_from_stream headers parsed. Leaving\n"); } } |