]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mailbox_get_status(): return cache fields allocated from data stack.
authorTimo Sirainen <tss@iki.fi>
Wed, 20 Oct 2010 15:03:13 +0000 (16:03 +0100)
committerTimo Sirainen <tss@iki.fi>
Wed, 20 Oct 2010 15:03:13 +0000 (16:03 +0100)
Allocating them from mailbox's pool just wastes memory if it's called multiple
times for same mailbox.

src/lib-storage/index/index-status.c

index 56a9824090c4da3d7615426db0f41f875b83b421..9ad25ff8bbe60c3de0d7df29329051de0db972cb 100644 (file)
@@ -19,10 +19,8 @@ index_storage_get_status_cache_fields(struct mailbox *box,
        fields = mail_cache_register_get_list(box->cache,
                                              pool_datastack_create(), &count);
 
-       /* a bit leaky to allocate memory from mailbox pool every time, but this
-          is unlikely to be called more than once for the mailbox anyway. */
-       cache_fields = p_new(box->pool, ARRAY_TYPE(const_string), 1);
-       p_array_init(cache_fields, box->pool, count);
+       cache_fields = t_new(ARRAY_TYPE(const_string), 1);
+       t_array_init(cache_fields, count);
        for (i = 0; i < count; i++) {
                dec = fields[i].decision & ~MAIL_CACHE_DECISION_FORCED;
                if (dec != MAIL_CACHE_DECISION_NO)