From: Brandon Williams <bmwill@google.com>
To: Stefan Beller <sbeller@google.com>
Cc: Junio C Hamano <gitster@pobox.com>,
"git@vger.kernel.org" <git@vger.kernel.org>,
Duy Nguyen <pclouds@gmail.com>
Subject: Re: [PATCHv5 4/5] worktree: get worktrees from submodules
Date: Wed, 7 Dec 2016 17:14:40 -0800 [thread overview]
Message-ID: <20161208011440.GM116201@google.com> (raw)
In-Reply-To: <CAGZ79kZiS9dx6QUOcFYh8sSNoVsrv2eNLXJd6X54UekzUiC8VQ@mail.gmail.com>
On 12/07, Stefan Beller wrote:
> On Wed, Dec 7, 2016 at 2:45 PM, Junio C Hamano <gitster@pobox.com> wrote:
> > Stefan Beller <sbeller@google.com> writes:
> >
> >> + submodule_common_dir = strbuf_detach(&sb, NULL);
> >> + ret = get_worktrees_internal(submodule_common_dir, flags);
> >> +
> >> + free(submodule_gitdir);
> >
> > This sequence felt somewhat unusual. I would have written this
> > without an extra variable, i.e.
> >
> > ret = get_worktrees_internal(sb.buf, flags);
> > strbuf_release(&sb);
>
> Yours is cleaner; I don't remember what I was thinking.
>
> Feel free to squash it in; in case a resend is needed I will do that.
Just make sure to leave that free in as it refers to another variable
(submodule_gitdir). It actually turns out there is a memory leak in the
original code because submodule_common_dir is never freed after being
detached from the strbuf.
--
Brandon Williams
next prev parent reply other threads:[~2016-12-08 1:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-07 21:01 [PATCHv5 0/5] submodule embedgitdirs Stefan Beller
2016-12-07 21:01 ` [PATCHv5 1/5] submodule: use absolute path for computing relative path connecting Stefan Beller
2016-12-07 21:01 ` [PATCHv5 2/5] submodule helper: support super prefix Stefan Beller
2016-12-07 21:01 ` [PATCHv5 3/5] test-lib-functions.sh: teach test_commit -C <dir> Stefan Beller
2016-12-07 21:01 ` [PATCHv5 4/5] worktree: get worktrees from submodules Stefan Beller
2016-12-07 22:45 ` Junio C Hamano
2016-12-07 22:51 ` Stefan Beller
2016-12-08 1:14 ` Brandon Williams [this message]
2016-12-07 21:01 ` [PATCHv5 5/5] submodule: add embed-git-dir function Stefan Beller
2016-12-07 23:03 ` Junio C Hamano
2016-12-07 23:37 ` Stefan Beller
2016-12-08 1:09 ` Brandon Williams
2016-12-08 11:01 ` Duy Nguyen
2016-12-07 22:35 ` [PATCHv5 0/5] submodule embedgitdirs Junio C Hamano
2016-12-07 23:34 ` Junio C Hamano
2016-12-07 23:39 ` Stefan Beller
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=20161208011440.GM116201@google.com \
--to=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=sbeller@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.