зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
34e02deb60
Коммит
0fb19906b5
1
remote.c
1
remote.c
|
@ -282,6 +282,7 @@ static void read_branches_file(struct remote *remote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
strbuf_getline(&buf, f, '\n');
|
strbuf_getline(&buf, f, '\n');
|
||||||
|
fclose(f);
|
||||||
strbuf_trim(&buf);
|
strbuf_trim(&buf);
|
||||||
if (!buf.len) {
|
if (!buf.len) {
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче