Commit 3ef2ebb6 3ef2ebb634a2d2d8c55423cc7ba371b3f6f8768b by Alain Magloire

some variables were not initialize, correct a bug in expunging.

1 parent 7941a5d4
......@@ -127,7 +127,7 @@ int message_save_attachment(message_t msg, const char *filename, void **data)
stream_t stream;
header_t hdr;
struct _msg_info *info = NULL;
int ret;
int ret = 0;
size_t size;
char *content_encoding;
......
......@@ -159,7 +159,7 @@ int
bio_write (bio_t bio, const char *ptr, size_t n, size_t *pnwriten)
{
int nleft;
int err;
int err = 0;
size_t nwriten = 0;
size_t total = 0;
......
......@@ -121,7 +121,7 @@ _file_write (stream_t stream, const char *iptr, size_t isize,
{
struct _file_stream *fs = stream_get_owner (stream);
size_t n;
int err;
int err = 0;
if (fs == NULL)
return EINVAL;
......
......@@ -40,7 +40,7 @@ mailer_create (mailer_t *pmailer, const char *name, int id)
mailer_entry_t entry = NULL;
list_t list = NULL;
iterator_t iterator;
int found;
int found = 0;
(void)id;
if (pmailer == NULL)
......
......@@ -749,16 +749,25 @@ mbox_expunge (mailbox_t mailbox)
mum = mud->umessages[j];
if (mum->new_flags && ATTRIBUTE_IS_DELETED (mum->new_flags))
{
if ((j + 1) >= mud->messages_count)
{
/* Move all the pointers up. So the message pointer
part of mum will be at the right position. */
memmove (mud->umessages + j, mud->umessages + j + 1,
(dlast - dirty) * sizeof (mum));
mum->header_from = mum->header_from_end = 0;
mum->header_status = mum->header_status_end = 0;
mum->body = mum->body_end = 0;
mum->header_lines = mum->body_lines = 0;
/* We are not free()ing the useless mum, but instead
we put it back in the pool, to be reuse. */
mud->umessages[dlast] = mum;
dlast--;
/* Set mum to the new value after the memmove so it
gets cleared to. */
mum = mud->umessages[j];
}
}
mum->header_from = mum->header_from_end = 0;
mum->header_status = mum->header_status_end = 0;
mum->body = mum->body_end = 0;
......