dovecot-2.1: lib-storage: Make sure status/metadata structs are ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 13 12:42:46 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/8eea5682ac5b
changeset: 13461:8eea5682ac5b
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 13 11:55:25 2011 +0300
description:
lib-storage: Make sure status/metadata structs are cleared when they're looked up.

diffstat:

 src/lib-storage/mail-storage.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (29 lines):

diff -r 50d0906b556f -r 8eea5682ac5b src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Tue Sep 13 11:38:49 2011 +0300
+++ b/src/lib-storage/mail-storage.c	Tue Sep 13 11:55:25 2011 +0300
@@ -1146,6 +1146,7 @@
 		       enum mailbox_status_items items,
 		       struct mailbox_status *status_r)
 {
+	memset(status_r, 0, sizeof(*status_r));
 	return box->v.get_status(box, items, status_r);
 }
 
@@ -1154,6 +1155,8 @@
 			     struct mailbox_status *status_r)
 {
 	i_assert(box->opened);
+
+	memset(status_r, 0, sizeof(*status_r));
 	if (box->v.get_status(box, items, status_r) < 0)
 		i_unreached();
 }
@@ -1161,6 +1164,8 @@
 int mailbox_get_metadata(struct mailbox *box, enum mailbox_metadata_items items,
 			 struct mailbox_metadata *metadata_r)
 {
+	memset(metadata_r, 0, sizeof(*metadata_r));
+
 	if (!box->opened) {
 		if (mailbox_open(box) < 0)
 			return -1;


More information about the dovecot-cvs mailing list