From: Brandon Casey Date: Thu, 16 Jul 2009 21:25:18 +0000 (-0500) Subject: refs.c: release file descriptor on error return X-Git-Tag: v1.6.4-rc2~9^2~5 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9d33f7c22fda81f7be8a7aa1576e6d399d3b45ec;p=git.git refs.c: release file descriptor on error return Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- diff --git a/refs.c b/refs.c index 90163bdc5..bb0762ee2 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)) {