From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Jeff King <peff@peff.net>,
git@vger.kernel.org, git-for-windows@googlegroups.com
Subject: Re: [PATCH 1/2 jk/war-on-sprintf] read_branches_file: plug a FILE* leak
Date: Fri, 23 Oct 2015 10:18:25 -0700 [thread overview]
Message-ID: <xmqqfv11pkpq.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <2c89c60e470def8f85941933c9fafe4db314628a.1445579874.git.j6t@kdbg.org> (Johannes Sixt's message of "Fri, 23 Oct 2015 08:02:51 +0200")
Johannes Sixt <j6t@kdbg.org> writes:
> 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>
> ---
Thanks (and also for 2/2).
> remote.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/remote.c b/remote.c
> index 1101f82..fb16153 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);
prev parent reply other threads:[~2015-10-23 17:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-23 6:02 [PATCH 1/2 jk/war-on-sprintf] read_branches_file: plug a FILE* leak Johannes Sixt
2015-10-23 6:02 ` [PATCH 2/2 jk/war-on-sprintf] compat/mingw.c: remove printf format warning Johannes Sixt
2015-10-23 11:20 ` Jeff King
2015-10-23 11:19 ` [PATCH 1/2 jk/war-on-sprintf] read_branches_file: plug a FILE* leak Jeff King
2015-10-23 17:18 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfv11pkpq.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git-for-windows@googlegroups.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).