mirror of
https://github.com/git/git
synced 2024-10-06 00:29:28 +00:00
apply: don't leak fd on fdopen() error
Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
3c2a3fdc38
commit
2b1f456adf
7
apply.c
7
apply.c
|
@ -4644,8 +4644,11 @@ static int write_out_one_reject(struct apply_state *state, struct patch *patch)
|
||||||
return error_errno(_("cannot open %s"), namebuf);
|
return error_errno(_("cannot open %s"), namebuf);
|
||||||
}
|
}
|
||||||
rej = fdopen(fd, "w");
|
rej = fdopen(fd, "w");
|
||||||
if (!rej)
|
if (!rej) {
|
||||||
return error_errno(_("cannot open %s"), namebuf);
|
error_errno(_("cannot open %s"), namebuf);
|
||||||
|
close(fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Normal git tools never deal with .rej, so do not pretend
|
/* Normal git tools never deal with .rej, so do not pretend
|
||||||
* this is a git patch by saying --git or giving extended
|
* this is a git patch by saying --git or giving extended
|
||||||
|
|
Loading…
Reference in a new issue