imap-send: fix memory leak in case auth_cram_md5 fails

This patch fixes a memory leak by running free(response) in case
auth_cram_md5 fails.

Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Aditya Garg
2025-06-20 12:10:25 +05:30
committed by Junio C Hamano
parent 44ba4b0bbb
commit ac4e02c503

View File

@@ -905,8 +905,10 @@ static int auth_cram_md5(struct imap_store *ctx, const char *prompt)
response = cram(prompt, ctx->cfg->user, ctx->cfg->pass);
ret = socket_write(&ctx->imap->buf.sock, response, strlen(response));
if (ret != strlen(response))
if (ret != strlen(response)) {
free(response);
return error("IMAP error: sending response failed");
}
free(response);