]> git.ipfire.org Git - thirdparty/git.git/commitdiff
imap-send: avoid leaking the IMAP upload buffer
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sun, 5 Jul 2026 08:24:26 +0000 (08:24 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 5 Jul 2026 16:12:10 +0000 (09:12 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
imap-send.c

index cfd6a5120c50e42293a581752eb3119489880a96..0d16d02029232b9869d83a9ff1fb5d6e12e703ad 100644 (file)
@@ -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)