git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 0/3] unpack-trees: memory-leak fixes

From
Elijah Newren <newren@gmail.com>
Date
Oct 7, 2021, 16:10 UTC
Message-ID
<CABPp-BGb2kkwRgu-c6DDBOTDCgJYWW+zmhV_ZgOogYqyVpGdLw@mail.gmail.com>
In-Reply-To
<cover-v2-0.3-00000000000-20211007T094019Z-avarab@gmail.com>
On Thu, Oct 7, 2021 at 2:46 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 34 quoted lines
>
> These patches fix a couple of stray memory leaks in unpack-trees.c.
>
> This goes on top of ab/sanitize-leak-ci (but not
> en/removing-untracked-fixes, although they combine to fix more leaks
> in the area).
>
> Changes since v1[1]:
>
> In rebasing v1 from some earlier patches I came up with something that
> didn't make sense with related fixes in Elijah's
> en/removing-untracked-fixes. This hopefully makes sense:
>
>  * The old 3/3 is gone, but there's a new 2-3/3 which fix the only
>    actual leak that was left, i.e. the one in sequencer.c.
>
>  * We might want something like the 3/3 from v1 of this series where
>    we call clear_unpack_trees_porcelain() everywhere (and rename it to
>    unpack_trees_options_release()) just for good measure and in case
>    we'd ever add something to the struct that needs unconditional
>    freeing.
>
>    But let's punt on that here and just keep the current
>    setup_unpack_trees_porcelain()/clear_unpack_trees_porcelain()
>    behavior, callers who don't use setup_unpack_trees_porcelain() but
>    use "struct unpack_trees_options" don't need to call any free-like
>    function at the end.
>
> 1. https://lore.kernel.org/git/cover-0.2-00000000000-20211006T093405Z-avarab@gmail.com/
>
> Ævar Arnfjörð Bjarmason (3):
>   unpack-trees: don't leak memory in verify_clean_subdirectory()
>   sequencer: add a "goto cleanup" to do_reset()
>   sequencer: fix a memory leak in do_reset()

Left a bunch of comments on patch 2. The upshot is anywhere from "the commit message just needs a few tweaks" to "well, maybe we should clean up these other things too, and we could restructure some related code...". I'll let you pick where in that spectrum you want to take things, because the other possible changes I mention beyond fixing the commit message don't need to hold up this series.

Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 13 of 17 in “dir & unpak-trees: memory-leak fixes”
  1. 0/2 dir & unpak-trees: memory-leak fixesÆvar Arnfjörð Bjarmason, Oct 6, 2021
  2. 1/2 unpack-trees: don't leak memory in verify_clean_subdirectory()Ævar Arnfjörð Bjarmason, Oct 6, 2021
  3. Elijah NewrenOct 6, 2021
  4. 2/2 built-ins & lib: plug memory leaks with unpack_trees_options_release()Ævar Arnfjörð Bjarmason, Oct 6, 2021
  5. Elijah NewrenOct 6, 2021
  6. Elijah NewrenOct 6, 2021
  7. 0/3 unpack-trees: memory-leak fixesÆvar Arnfjörð Bjarmason, Oct 7, 2021
  8. 2/3 sequencer: add a "goto cleanup" to do_reset()Ævar Arnfjörð Bjarmason, Oct 7, 2021
  9. Elijah NewrenOct 7, 2021
  10. 1/3 unpack-trees: don't leak memory in verify_clean_subdirectory()Ævar Arnfjörð Bjarmason, Oct 7, 2021
  11. Junio C HamanoOct 7, 2021
  12. 3/3 sequencer: fix a memory leak in do_reset()Ævar Arnfjörð Bjarmason, Oct 7, 2021
  13. Elijah NewrenOct 7, 2021
  14. 0/3 unpack-trees: memory-leak fixesÆvar Arnfjörð Bjarmason, Oct 13, 2021
  15. 1/3 unpack-trees: don't leak memory in verify_clean_subdirectory()Ævar Arnfjörð Bjarmason, Oct 13, 2021
  16. 2/3 sequencer: add a "goto cleanup" to do_reset()Ævar Arnfjörð Bjarmason, Oct 13, 2021
  17. 3/3 sequencer: fix a memory leak in do_reset()Ævar Arnfjörð Bjarmason, Oct 13, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.