Skip to content

Commit

Permalink
refs.c: release file descriptor on error return
Browse files Browse the repository at this point in the history
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Brandon Casey authored and Junio C Hamano committed Jul 16, 2009
1 parent 49902bd commit 9d33f7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 9d33f7c

Please sign in to comment.