From 2f1d1a52924c081bd243e3b7a900d1ec3e401ee9 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 15 Dec 2017 14:32:23 +0000 Subject: [PATCH] fix resource leaks --- attach.c | 1 + nntp.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/attach.c b/attach.c index 93f8c2092..6fab3a185 100644 --- a/attach.c +++ b/attach.c @@ -185,6 +185,7 @@ int mutt_compose_attachment(struct Body *a) if (!tfp) { mutt_perror(_("Failure to open file to strip headers.")); + mutt_file_fclose(&fp); goto bailout; } mutt_file_copy_stream(fp, tfp); diff --git a/nntp.c b/nntp.c index fa5add077..c934f048a 100644 --- a/nntp.c +++ b/nntp.c @@ -1779,7 +1779,10 @@ int nntp_post(const char *msg) } if (mutt_socket_write_d(nntp_data->nserv->conn, buf[1] == '.' ? buf : buf + 1, -1, MUTT_SOCK_LOG_HDR) < 0) + { + mutt_file_fclose(&fp); return nntp_connect_error(nntp_data->nserv); + } } mutt_file_fclose(&fp); -- 2.40.0