Re: [PATCH v2 6/6] revisions API: don't leak memory on argv elements that need free()-ing
- From
Jeff King <peff@peff.net>
- Date
- Jul 29, 2022, 19:00 UTC
- Message-ID
- <YuQuWPHK1iwuJvd4@coredump.intra.peff.net>
- In-Reply-To
- <patch-v2-6.6-3c57e126554-20220729T082919Z-avarab@gmail.com>
On Fri, Jul 29, 2022 at 10:31:08AM +0200, Ævar Arnfjörð Bjarmason wrote:
> Add a "free_removed_argv_elements" member to "struct > setup_revision_opt", and use it to fix several memory leaks, e.g. the > one with a "XXX" comment added in 8a534b61241 (bisect: use argv_array > API, 2011-09-13).
I think the mention of this "XXX" comment is a little misleading. That comment is not talking about leaking the "--" entry. It is talking about leaking the _entire_ strvec, because of memory-lifetime issues. And we fixed those already in 5.
It's a small point, and the code here is fine. But if you take my suggested replacement for 5, then it becomes even more nonsensical. ;)
-Peff