[PATCH v2 09/12] imap-send: avoid leaking the IMAP upload buffer
- From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Jul 5, 2026, 08:24 UTC
- Message-ID
- <4048a225a5c3c0b698a2dbc58c756d217f851a72.1783239870.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.2163.v2.git.1783239870.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
When uploading messages via libcurl, `curl_append_msgs_to_imap()` accumulates each one in a strbuf that grows across loop iterations but is never released before the function returns.
Release it alongside the existing libcurl cleanup.
Reported by Coverity as CID 1671507 ("Resource leak").Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- imap-send.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/imap-send.c b/imap-send.c index cfd6a5120c..0d16d02029 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1750,6 +1750,7 @@ static int curl_append_msgs_to_imap(struct imap_server_conf *server, curl_easy_cleanup(curl); curl_global_cleanup(); + strbuf_release(&msgbuf.buf); if (cred.username) { if (res == CURLE_OK)
-- gitgitgadget