[evolution-data-server] Bug #527614 - Valgrind shows a nice amount of lost memory



commit 3b5d75a8c014370ace9fa804ae710513983d208e
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 20 09:01:55 2011 +0200

    Bug #527614 - Valgrind shows a nice amount of lost memory

 camel/camel-http-stream.c               |    3 +++
 camel/camel-mime-part.c                 |    3 +++
 camel/providers/imap/camel-imap-store.c |    6 ++++++
 3 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-http-stream.c b/camel/camel-http-stream.c
index 0d2a35f..77472f4 100644
--- a/camel/camel-http-stream.c
+++ b/camel/camel-http-stream.c
@@ -362,6 +362,9 @@ http_stream_finalize (GObject *object)
 	if (http->proxy)
 		camel_url_free (http->proxy);
 
+	if (http->user_agent)
+		g_free (http->user_agent);
+
 	g_free (http->authrealm);
 	g_free (http->authpass);
 
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 80261e1..7091d04 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -184,6 +184,9 @@ write_references (CamelStream *stream,
 static void
 init_header_name_table (void)
 {
+	if (header_name_table)
+		return;
+
 	header_name_table = g_hash_table_new (
 		camel_strcase_hash, camel_strcase_equal);
 	g_hash_table_insert (
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 5deabf8..9d72621 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -157,6 +157,8 @@ parse_capability (CamelImapStore *store,
 	}
 }
 
+static gboolean free_key (gpointer key, gpointer value, gpointer user_data);
+
 static gboolean
 imap_get_capability (CamelService *service,
                      GCancellable *cancellable,
@@ -169,6 +171,10 @@ imap_get_capability (CamelService *service,
 	/* Find out the IMAP capabilities */
 	/* We assume we have utf8 capable search until a failed search tells us otherwise */
 	store->capabilities = IMAP_CAPABILITY_utf8_search;
+	if (store->authtypes) {
+		g_hash_table_foreach_remove (store->authtypes, free_key, NULL);
+		g_hash_table_destroy (store->authtypes);
+	}
 	store->authtypes = g_hash_table_new (g_str_hash, g_str_equal);
 	response = camel_imap_command (store, NULL, cancellable, error, "CAPABILITY");
 	if (!response)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]