Skip to content

Commit a520816

Browse files
committed
am: close input stream even in case of an error
Reported via Coverity. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 6b88dd4 commit a520816

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

builtin/am.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,9 +762,11 @@ static int split_mail_conv(mail_conv_fn fn, struct am_state *state,
762762
mail = mkpath("%s/%0*d", state->dir, state->prec, i + 1);
763763

764764
out = fopen(mail, "w");
765-
if (!out)
765+
if (!out) {
766+
fclose(in);
766767
return error_errno(_("could not open '%s' for writing"),
767768
mail);
769+
}
768770

769771
ret = fn(out, in, keep_cr);
770772

0 commit comments

Comments
 (0)