提交 9d33f7c2 编写于 作者: B Brandon Casey 提交者: Junio C Hamano

refs.c: release file descriptor on error return

Signed-off-by: NBrandon Casey <drafnel@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 49902bd8
......@@ -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)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册