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

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

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 13, 2021, 13:23 UTC
Message-ID
<cover-v3-0.3-00000000000-20211013T132223Z-avarab@gmail.com>
In-Reply-To
<cover-v2-0.3-00000000000-20211007T094019Z-avarab@gmail.com>

This commit-message-only-change to v2 should address the comments Elijah had on v2 (see link in the range-diff). I.e. there's probably bug in adjacent code in leaving a stale lockfile, but I'm punting on that and just narrowly fixing a memory leak here.

Æ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()
 sequencer.c                 | 36 +++++++++++++++---------------------
 t/t1001-read-tree-m-2way.sh |  2 ++
 unpack-trees.c              |  3 ++-
 3 files changed, 19 insertions(+), 22 deletions(-)
Range-diff against v2:
1:  e5ef1be2aa9 = 1:  0ab1e74f50d unpack-trees: don't leak memory in verify_clean_subdirectory()
2:  1d5f5e9fff0 ! 2:  393937e8a98 sequencer: add a "goto cleanup" to do_reset()
    @@ Commit message
         unconditionally free desc.buffer, it won't be initialized on the first
         couple of "goto"'s.
     
    -    There are three earlier "return"'s in this function that I'm not
    -    bothering to covert, those don't need to rollback anything, or free
    -    any resources, so let's leave, even though they could safely "goto
    -    cleanup" as well.
    +    There are three earlier "return"'s in this function which should
    +    probably be made to use this new "cleanup" too, per [1] it looks like
    +    they're leaving behind stale locks. But let's not try to fix every
    +    potential bug here now, I'm just trying to narrowly plug a memory
    +    leak.
    +
    +    1. https://lore.kernel.org/git/CABPp-BH=3DP-dXRCphY53-3eZd1TU8h5GY_M12nnbEGm-UYB9Q@mail.gmail.com/
     
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
3:  66ae63db8fd ! 3:  00b6b469a8c sequencer: fix a memory leak in do_reset()
    @@ Commit message
         setup_unpack_trees_porcelain() without a corresponding call to
         clear_unpack_trees_porcelain().
     
    +    This introduces a change in behavior in that we now start calling
    +    clear_unpack_trees_porcelain() even without having called the
    +    setup_unpack_trees_porcelain(). That's OK, that clear function, like
    +    most others, will accept a zero'd out struct.
    +
         This inches us closer to passing various tests in
         "t34*.sh" (e.g. "t3434-rebase-i18n.sh"), but because they have so many
         other memory leaks in revisions.c this doesn't make any test file or
-- 
2.33.0.1569.gd2dc77f7abf
Previous: Elijah NewrenNext: Ævar Arnfjörð Bjarmason
Message 14 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.