dovecot-2.0: Memory leak fixes.

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 28 15:30:02 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/dfca32cdab43
changeset: 10814:dfca32cdab43
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 28 15:29:59 2010 +0200
description:
Memory leak fixes.

diffstat:

 src/lib-master/master-service-settings-cache.c |  7 ++++++-
 src/lib-storage/mail-storage-service.c         |  3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diffs (56 lines):

diff -r 197d9beec207 -r dfca32cdab43 src/lib-master/master-service-settings-cache.c
--- a/src/lib-master/master-service-settings-cache.c	Sun Feb 28 15:28:00 2010 +0200
+++ b/src/lib-master/master-service-settings-cache.c	Sun Feb 28 15:29:59 2010 +0200
@@ -74,18 +74,23 @@
 	struct master_service_settings_cache *cache = *_cache;
 	struct settings_entry *entry, *next;
 
+	/* parsers need to be deinitialized, because they reference the pool */
 	for (entry = cache->oldest_global; entry != NULL; entry = next) {
 		next = entry->next;
+		settings_parser_deinit(&entry->parser);
 		pool_unref(&entry->pool);
 	}
 	for (entry = cache->oldest; entry != NULL; entry = next) {
 		next = entry->next;
+		settings_parser_deinit(&entry->parser);
 		pool_unref(&entry->pool);
 	}
 	if (cache->local_host_hash != NULL)
 		hash_table_destroy(&cache->local_host_hash);
 	if (cache->local_ip_hash != NULL)
 		hash_table_destroy(&cache->local_ip_hash);
+	if (cache->global_parser != NULL)
+		settings_parser_deinit(&cache->global_parser);
 	pool_unref(&cache->pool);
 }
 
@@ -148,7 +153,6 @@
 setting_entry_detach(struct master_service_settings_cache *cache,
 		     struct settings_entry *entry)
 {
-		
 	DLLIST2_REMOVE(&cache->oldest, &cache->newest, entry);
 	cache->cache_malloc_size -=
 		pool_alloconly_get_total_alloc_size(entry->pool);
@@ -157,6 +161,7 @@
 		hash_table_remove(cache->local_host_hash, entry->local_host);
 	if (entry->local_ip.family != 0)
 		hash_table_remove(cache->local_ip_hash, &entry->local_ip);
+	settings_parser_deinit(&entry->parser);
 }
 
 static void cache_add(struct master_service_settings_cache *cache,
diff -r 197d9beec207 -r dfca32cdab43 src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c	Sun Feb 28 15:28:00 2010 +0200
+++ b/src/lib-storage/mail-storage-service.c	Sun Feb 28 15:29:59 2010 +0200
@@ -498,7 +498,8 @@
 		count = 0;
 	else
 		for (count = 0; set_roots[count] != NULL; count++) ;
-	ctx->set_roots = i_new(const struct setting_parser_info *, count + 2);
+	ctx->set_roots =
+		p_new(pool, const struct setting_parser_info *, count + 2);
 	ctx->set_roots[0] = &mail_user_setting_parser_info;
 	memcpy(ctx->set_roots + 1, set_roots, sizeof(*ctx->set_roots) * count);
 


More information about the dovecot-cvs mailing list