From: Richard Russon Date: Fri, 16 Nov 2018 14:49:36 +0000 (+0000) Subject: fix leak in imap_status() X-Git-Tag: 2019-10-25~517 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d6e8758edda197ed95e099b7e82efe92da6ccba;p=neomutt fix leak in imap_status() --- diff --git a/imap/imap.c b/imap/imap.c index 487e476b9..10c52aaca 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1432,7 +1432,10 @@ int imap_status(const char *path, bool queue) * Note that imap_mxcmp() converts NULL to "INBOX", so we need to * make sure the adata really is open to a folder. */ if (adata->mailbox && !imap_mxcmp(mdata->name, adata->mbox_name)) + { + imap_mdata_free((void **) &mdata); return adata->mailbox->msg_count; + } else if (mutt_bit_isset(adata->capabilities, IMAP4REV1) || mutt_bit_isset(adata->capabilities, STATUS)) @@ -1443,6 +1446,7 @@ int imap_status(const char *path, bool queue) { /* Server does not support STATUS, and this is not the current mailbox. * There is no lightweight way to check recent arrivals */ + imap_mdata_free((void **) &mdata); return -1; } @@ -1450,6 +1454,7 @@ int imap_status(const char *path, bool queue) { imap_exec(adata, buf, IMAP_CMD_QUEUE); queued = 1; + imap_mdata_free((void **) &mdata); return 0; } else if (!queued) @@ -1457,6 +1462,7 @@ int imap_status(const char *path, bool queue) queued = 0; status = imap_mboxcache_get(adata, mdata->name, false); + imap_mdata_free((void **) &mdata); if (status) return status->messages;