Skip to content

Commit 3eb83e8

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 f5a5b92 commit 3eb83e8

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
@@ -1072,8 +1072,10 @@ static int auth_cram_md5(struct imap_store *ctx, const char *prompt)
10721072
response = cram(prompt, ctx->cfg->user, ctx->cfg->pass);
10731073

10741074
ret = socket_write(&ctx->imap->buf.sock, response, strlen(response));
1075-
if (ret != strlen(response))
1075+
if (ret != strlen(response)) {
1076+
free(response);
10761077
return error("IMAP error: sending response failed");
1078+
}
10771079

10781080
free(response);
10791081

0 commit comments

Comments
 (0)