]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Memory leak fixes.
authorTimo Sirainen <tss@iki.fi>
Sun, 28 Feb 2010 13:29:59 +0000 (15:29 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 28 Feb 2010 13:29:59 +0000 (15:29 +0200)
--HG--
branch : HEAD

src/lib-master/master-service-settings-cache.c
src/lib-storage/mail-storage-service.c

index e4a946043ca3a5ed48e4ca3d74cb1ef6a9af21a9..805bacdec3de30d352b3edfba32a9b6b36462fb8 100644 (file)
@@ -74,18 +74,23 @@ void master_service_settings_cache_deinit(struct master_service_settings_cache *
        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 @@ static void
 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 @@ setting_entry_detach(struct master_service_settings_cache *cache,
                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,
index 87507fd1a89311d0db0ec9e08f771922cbd8a421..87cf1230ed7dd30bdcbe4d3f63eb62160b8a29a3 100644 (file)
@@ -498,7 +498,8 @@ mail_storage_service_init(struct master_service *service,
                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);