Merge branch 'rs/apply-reject-fd-leakfix'
A file descriptor leak in an error codepath, used when "git apply --reject" fails to create the *.rej file, has been corrected. * rs/apply-reject-fd-leakfix: apply: don't leak fd on fdopen() error
This commit is contained in:
7
apply.c
7
apply.c
@@ -4665,8 +4665,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
|
||||||
|
|||||||
Reference in New Issue
Block a user