{
a = account_new();
a->magic = m->magic;
- TAILQ_INSERT_TAIL(&AllAccounts, a, entries);
new_account = true;
}
{
//error
mailbox_free(&m);
+ if (new_account)
+ {
+ FREE(&a);
+ }
continue;
}
+ if (new_account)
+ {
+ TAILQ_INSERT_TAIL(&AllAccounts, a, entries);
+ }
struct MailboxNode *mn = mutt_mem_calloc(1, sizeof(*mn));
mn->mailbox = m;
if (!m->account)
{
struct Account *a = mx_ac_find(m);
+ bool new_account = false;
if (!a)
{
a = account_new();
a->magic = m->magic;
- TAILQ_INSERT_TAIL(&AllAccounts, a, entries);
+ new_account = true;
}
if (mx_ac_add(a, m) < 0)
{
ctx_free(&ctx);
+ if (new_account)
+ {
+ FREE(&a);
+ }
return NULL;
}
+ if (new_account)
+ {
+ TAILQ_INSERT_TAIL(&AllAccounts, a, entries);
+ }
}
ctx->msgnotreadyet = -1;