Skip to content

Commit ac4e02c

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 44ba4b0 commit ac4e02c

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

907907
ret = socket_write(&ctx->imap->buf.sock, response, strlen(response));
908-
if (ret != strlen(response))
908+
if (ret != strlen(response)) {
909+
free(response);
909910
return error("IMAP error: sending response failed");
911+
}
910912

911913
free(response);
912914

0 commit comments

Comments
 (0)