Signed-off-by: Junio C Hamano <gits...@pobox.com>
---
 builtin/am.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/builtin/am.c b/builtin/am.c
index f1a84c6..a373928 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -761,9 +761,11 @@ static int split_mail_conv(mail_conv_fn fn, struct 
am_state *state,
                mail = mkpath("%s/%0*d", state->dir, state->prec, i + 1);
 
                out = fopen(mail, "w");
-               if (!out)
+               if (!out) {
+                       fclose(in);
                        return error(_("could not open '%s' for writing: %s"),
                                        mail, strerror(errno));
+               }
 
                ret = fn(out, in, keep_cr);
 
-- 
2.8.2-679-g91c6421

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to