Fix bug in imap_keepalive() which erroneously free Context when the
IMAP connection is shut down by the server. From upstream, via edd@ OK espie@
This commit is contained in:
parent
cfeca50d36
commit
7c9020055c
@ -1,10 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.58 2010/05/18 08:31:02 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.59 2010/08/09 09:54:14 dcoppa Exp $
|
||||
|
||||
COMMENT= tty-based e-mail client, development version
|
||||
|
||||
VERSION= 1.5.20
|
||||
DISTNAME= mutt-${VERSION}
|
||||
PKGNAME= ${DISTNAME}p2
|
||||
REVISION= 3
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=mutt/} \
|
||||
${MASTER_SITES_MUTT:=devel/}
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
$OpenBSD: patch-imap_util_c,v 1.1 2009/07/29 20:26:45 sthen Exp $
|
||||
$OpenBSD: patch-imap_util_c,v 1.2 2010/08/09 09:54:15 dcoppa Exp $
|
||||
|
||||
add hcache debug, re ticket #3296
|
||||
|
||||
--- imap/util.c.orig Wed Jun 10 05:17:20 2009
|
||||
+++ imap/util.c Wed Jul 29 20:48:32 2009
|
||||
fix bug in imap_keepalive() which erroneously free Context when the
|
||||
IMAP connection is shut down by the server.
|
||||
|
||||
--- imap/util.c.orig Wed Jun 10 06:17:20 2009
|
||||
+++ imap/util.c Mon Aug 9 11:37:57 2010
|
||||
@@ -129,6 +129,8 @@ HEADER* imap_hcache_get (IMAP_DATA* idata, unsigned in
|
||||
{
|
||||
if (*uv == idata->uid_validity)
|
||||
@ -13,3 +16,31 @@ add hcache debug, re ticket #3296
|
||||
FREE (&uv);
|
||||
}
|
||||
|
||||
@@ -731,6 +733,8 @@ void imap_keepalive (void)
|
||||
{
|
||||
if (conn->account.type == M_ACCT_TYPE_IMAP)
|
||||
{
|
||||
+ int need_free = 0;
|
||||
+
|
||||
idata = (IMAP_DATA*) conn->data;
|
||||
|
||||
if (idata->state >= IMAP_AUTHENTICATED
|
||||
@@ -742,9 +746,17 @@ void imap_keepalive (void)
|
||||
{
|
||||
ctx = safe_calloc (1, sizeof (CONTEXT));
|
||||
ctx->data = idata;
|
||||
+ /* imap_close_mailbox will set ctx->iadata->ctx to NULL, so we can't
|
||||
+ * rely on the value of iadata->ctx to determine if this placeholder
|
||||
+ * context needs to be freed.
|
||||
+ */
|
||||
+ need_free = 1;
|
||||
}
|
||||
+ /* if the imap connection closes during this call, ctx may be invalid
|
||||
+ * after this point, and thus should not be read.
|
||||
+ */
|
||||
imap_check_mailbox (ctx, NULL, 1);
|
||||
- if (!idata->ctx)
|
||||
+ if (need_free)
|
||||
FREE (&ctx);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user