summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorBrandon Casey <drafnel@gmail.com>2009-07-16 21:25:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-07-16 22:07:24 (GMT)
commit9d33f7c22fda81f7be8a7aa1576e6d399d3b45ec (patch)
tree67c4fcdb7842a93fe70202d0a032adf0e1a7c089 /refs.c
parent49902bd8561392e979c54344ae98dfab7a7ecf05 (diff)
downloadgit-9d33f7c22fda81f7be8a7aa1576e6d399d3b45ec.zip
git-9d33f7c22fda81f7be8a7aa1576e6d399d3b45ec.tar.gz
git-9d33f7c22fda81f7be8a7aa1576e6d399d3b45ec.tar.bz2
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>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 90163bd..bb0762e 100644
--- a/refs.c
+++ b/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)) {