mirror of
https://github.com/git/git.git
synced 2024-11-27 12:03:55 +08:00
refs.c: release file descriptor on error return
Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
49902bd856
commit
9d33f7c22f
4
refs.c
4
refs.c
@ -1525,8 +1525,10 @@ int for_each_recent_reflog_ent(const char *ref, each_reflog_ent_fn fn, long ofs,
|
||||
if (fstat(fileno(logfp), &statbuf) ||
|
||||
statbuf.st_size < ofs ||
|
||||
fseek(logfp, -ofs, SEEK_END) ||
|
||||
fgets(buf, sizeof(buf), logfp))
|
||||
fgets(buf, sizeof(buf), logfp)) {
|
||||
fclose(logfp);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
while (fgets(buf, sizeof(buf), logfp)) {
|
||||
|
Loading…
Reference in New Issue
Block a user