diff options
| author | Aditya Garg <gargaditya08@live.com> | 2025-06-20 12:10:25 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-06-20 08:11:16 -0700 |
| commit | ac4e02c5030c05d71b20127a7118b0a0fc3c1c64 (patch) | |
| tree | ca1d2489735ba389375db0e8f59fa375b9ad1445 | |
| parent | 44ba4b0bbb1a342659ca93d9ba6f475fbf9cff99 (diff) | |
| download | git-ac4e02c5030c05d71b20127a7118b0a0fc3c1c64.tar.xz | |
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>
| -rw-r--r-- | imap-send.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/imap-send.c b/imap-send.c index 37f94a37e8..1a582c8443 100644 --- a/imap-send.c +++ b/imap-send.c @@ -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); |
