From: Stefan Beller <sbeller@google.com>
To: Jeff King <peff@peff.net>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
Jonathan Nieder <jrnieder@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 3/5] submodule: helper to run foreach in parallel
Date: Wed, 26 Aug 2015 10:21:08 -0700 [thread overview]
Message-ID: <CAGZ79kaWh5F_d9TGHFe-fAd5arFicaAVcmYnWnAS2Wn1PoGMzg@mail.gmail.com> (raw)
In-Reply-To: <20150826170647.GA1870@sigill.intra.peff.net>
On Wed, Aug 26, 2015 at 10:06 AM, Jeff King <peff@peff.net> wrote:
> On Tue, Aug 25, 2015 at 10:28:24AM -0700, Stefan Beller wrote:
>
>> +int module_foreach_parallel(int argc, const char **argv, const char *prefix)
>> +{
>> [...]
>> + for (i = 0; i < ce_used; i++) {
>> + const struct submodule *sub;
>> + const struct cache_entry *ce = ce_entries[i];
>> + struct submodule_args *args = malloc(sizeof(*args));
>> +
>> + if (ce_stage(ce))
>> + args->sha1 = xstrdup(sha1_to_hex(null_sha1));
>> + else
>> + args->sha1 = xstrdup(sha1_to_hex(ce->sha1));
>> +
>> + strbuf_reset(&sb);
>> + strbuf_addf(&sb, "%s/.git", ce->name);
>> + if (!file_exists(sb.buf))
>> + continue;
>
> "args" and "args->sha1" go out of scope and leak here.
>
>> + args->name = sub->name;
>> + args->toplevel = xstrdup(xgetcwd());
>
> Another xgetcwd leak. :) I think this one can just drop the xstrdup.
>
> (Both of these were spotted by Coverity. I know you have played with it
> a little, so if you are actually reading the emails it sends, I'll stop
> relaying them).
Fixing those memleaks was the first thing I did this morning. :)
And yeah I do pay attention to these emails. (I maintain the automatic testing
every other day, so there is that.)
>
> -Peff
next prev parent reply other threads:[~2015-08-26 17:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 17:28 [RFC PATCH 0/5] Demonstrate new parallel threading API Stefan Beller
2015-08-25 17:28 ` [PATCH 1/5] FIXUP submodule: implement `module_clone` as a builtin helper Stefan Beller
2015-08-25 17:28 ` [PATCH 2/5] thread-utils: add a threaded task queue Stefan Beller
2015-08-25 17:28 ` [PATCH 3/5] submodule: helper to run foreach in parallel Stefan Beller
2015-08-25 21:09 ` Junio C Hamano
2015-08-25 21:42 ` Stefan Beller
2015-08-25 22:23 ` Junio C Hamano
2015-08-25 22:44 ` Junio C Hamano
2015-08-26 17:06 ` Jeff King
2015-08-26 17:21 ` Stefan Beller [this message]
2015-08-25 17:28 ` [PATCH 4/5] index-pack: Use the new worker pool Stefan Beller
2015-08-25 19:03 ` Jeff King
2015-08-25 19:23 ` Stefan Beller
2015-08-25 20:41 ` Junio C Hamano
2015-08-25 20:59 ` Stefan Beller
2015-08-25 21:12 ` Junio C Hamano
2015-08-25 22:39 ` Stefan Beller
2015-08-25 22:50 ` Junio C Hamano
2015-08-25 17:28 ` [PATCH 5/5] pack-objects: Use " Stefan Beller
-- strict thread matches above, loose matches on Subject: below --
2015-08-27 0:52 [RFC PATCH 0/5] Progressing with `git submodule foreach_parallel` Stefan Beller
2015-08-27 0:52 ` [PATCH 3/5] submodule: helper to run foreach in parallel 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=CAGZ79kaWh5F_d9TGHFe-fAd5arFicaAVcmYnWnAS2Wn1PoGMzg@mail.gmail.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--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).