提交 0fb19906 编写于 作者: J Johannes Sixt 提交者: Junio C Hamano

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: NJohannes Sixt <j6t@kdbg.org>
Acked-by: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 34e02deb
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册