am: close input stream even in case of an error

Reported via Coverity.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2017-04-21 14:43:04 +02:00
parent 6b88dd4e15
commit a5208164e2

View File

@@ -762,9 +762,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_errno(_("could not open '%s' for writing"),
mail);
}
ret = fn(out, in, keep_cr);