Skip to content

Commit bc44ab7

Browse files
AdityaGarg8gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f42f7f5 commit bc44ab7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

imap-send.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,8 +1046,10 @@ static int auth_cram_md5(struct imap_store *ctx, const char *prompt)
10461046
response = cram(prompt, ctx->cfg->user, ctx->cfg->pass);
10471047

10481048
ret = socket_write(&ctx->imap->buf.sock, response, strlen(response));
1049-
if (ret != strlen(response))
1049+
if (ret != strlen(response)) {
1050+
free(response);
10501051
return error("IMAP error: sending response failed");
1052+
}
10511053

10521054
free(response);
10531055

0 commit comments

Comments
 (0)