summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Johannes Sixt <j6t@kdbg.org>2015-10-23 08:02:51 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-10-23 10:17:48 -0700
commit0fb19906b5eb8fff9af59531aacd023920a24495 (patch)
tree52d655816d0436cf5aeb673306b6ae4e61ce9317
parentname-rev: use strip_suffix to avoid magic numbers (diff)
downloadtgif-0fb19906b5eb8fff9af59531aacd023920a24495.tar.xz
read_branches_file: plug a FILE* leak
The earlier rewrite f28e3ab2 (read_branches_file: simplify string handling) of read_branches_file() lost an fclose() call. Put it back. As on Windows files that are open cannot be removed, the leak manifests in a failure of 'git remote rename origin origin' when the remote's URL is specified in .git/branches/origin, because by the time that the command attempts to remove this file, it is still open. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--remote.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/remote.c b/remote.c
index 1101f82eaf..fb161530cd 100644
--- a/remote.c
+++ b/remote.c
@@ -282,6 +282,7 @@ static void read_branches_file(struct remote *remote)
return;
strbuf_getline(&buf, f, '\n');
+ fclose(f);
strbuf_trim(&buf);
if (!buf.len) {
strbuf_release(&buf);