changeset 12697:113b54dcb950

dsync: Fixed crash when mailbox had zero cache_fields but its array was initialized.
author Timo Sirainen <tss@iki.fi>
date Sun, 16 Jan 2011 18:53:27 +0200
parents af92646d36d6
children c75a13e5b678
files src/dsync/dsync-data.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/dsync/dsync-data.c	Thu Jan 13 13:18:20 2011 +0200
+++ b/src/dsync/dsync-data.c	Sun Jan 16 18:53:27 2011 +0200
@@ -19,7 +19,9 @@
 
 	if (array_is_created(&box->cache_fields))
 		cache_fields = array_get(&box->cache_fields, &count);
-	if (count > 0) {
+	if (count == 0)
+		memset(&dest->cache_fields, 0, sizeof(dest->cache_fields));
+	else {
 		p_array_init(&dest->cache_fields, pool, count);
 		for (i = 0; i < count; i++) {
 			dup = p_strdup(pool, cache_fields[i]);