--- dovecot-2.0.beta6.orig/src/plugins/virtual/virtual-config.c
+++ dovecot-2.0.beta6/src/plugins/virtual/virtual-config.c
@@ -400,10 +400,12 @@ void virtual_config_free(struct virtual_
        struct virtual_backend_box *const *bboxes;
        unsigned int i, count;

-       bboxes = array_get_modifiable(&mbox->backend_boxes, &count);
-       for (i = 0; i < count; i++) {
-               if (bboxes[i]->search_args != NULL)
-                       mail_search_args_unref(&bboxes[i]->search_args);
+       if (array_is_created(&mbox->backend_boxes)) {
+               bboxes = array_get_modifiable(&mbox->backend_boxes, &count);
+               for (i = 0; i < count; i++) {
+                       if (bboxes[i]->search_args != NULL)
+                               mail_search_args_unref(&bboxes[i]->search_args);
+               }
+               array_free(&mbox->backend_boxes);
        }
-       array_free(&mbox->backend_boxes);
 }