Browse Source

fix re-using server connections for new stores

we failed to reset the box list pointer after freeing it, which would
lead to a crash.
we also failed to reset the listing status, which would lead to
malfunction if we hadn't already crashed.

this inlines imap_cleanup_store(), as there isn't much value in keeping
it. the message list is already freed when disowning the store anyway.
wip/unchecked-remove
Oswald Buddenhagen 4 years ago
parent
commit
542e38dd49
  1. 15
      src/drv_imap.c

15
src/drv_imap.c

@ -1558,14 +1558,6 @@ get_cmd_result_p2( imap_store_t *ctx, imap_cmd_t *cmd, int response )
/******************* imap_cancel_store *******************/
static void
imap_cleanup_store( imap_store_t *ctx )
{
free_generic_messages( ctx->msgs );
free_string_list( ctx->boxes );
}
static void
imap_cancel_store( store_t *gctx )
{
@ -1581,7 +1573,8 @@ imap_cancel_store( store_t *gctx )
free_list( ctx->ns_other );
free_list( ctx->ns_shared );
free_string_list( ctx->auth_mechs );
imap_cleanup_store( ctx );
free_generic_messages( ctx->msgs );
free_string_list( ctx->boxes );
imap_deref( ctx );
}
@ -1718,7 +1711,9 @@ imap_alloc_store( store_conf_t *conf, const char *label )
for (ctxp = &unowned; (ctx = (imap_store_t *)*ctxp); ctxp = &ctx->gen.next)
if (ctx->state != SST_BAD && ((imap_store_conf_t *)ctx->gen.conf)->server == srvc) {
*ctxp = ctx->gen.next;
imap_cleanup_store( ctx );
free_string_list( ctx->boxes );
ctx->boxes = NULL;
ctx->listed = 0;
/* One could ping the server here, but given that the idle timeout
* is at least 30 minutes, this sounds pretty pointless. */
ctx->state = SST_HALF;

Loading…
Cancel
Save