From: Timo Sirainen Date: Wed, 20 Oct 2010 15:03:13 +0000 (+0100) Subject: lib-storage: mailbox_get_status(): return cache fields allocated from data stack. X-Git-Tag: 2.0.6~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f43dce346825f632b02527f2a774de36718635d7;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: mailbox_get_status(): return cache fields allocated from data stack. Allocating them from mailbox's pool just wastes memory if it's called multiple times for same mailbox. --- diff --git a/src/lib-storage/index/index-status.c b/src/lib-storage/index/index-status.c index 56a9824090..9ad25ff8bb 100644 --- a/src/lib-storage/index/index-status.c +++ b/src/lib-storage/index/index-status.c @@ -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)