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).
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html