Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
base: 91016984db40c41df0ab8ec39344e703cf6a2a2b
Choose a base ref
...
head repository: git/git
compare: 6e658547d35515da6ba55d285d6699b7f04cb939
Choose a head ref
  • 4 commits
  • 17 files changed
  • 2 contributors

Commits on Oct 7, 2021

  1. Merge branch 'ab/sanitize-leak-ci' into ab/unpack-trees-leakfix

    * ab/sanitize-leak-ci:
      tests: add a test mode for SANITIZE=leak, run it in CI
      Makefile: add SANITIZE=leak flag to GIT-BUILD-OPTIONS
    gitster committed Oct 7, 2021
    Copy the full SHA
    9d05b45 View commit details
    Browse the repository at this point in the history
  2. unpack-trees: don't leak memory in verify_clean_subdirectory()

    Fix two different but related memory leaks in
    verify_clean_subdirectory(). We leaked both the "pathbuf" if
    read_directory() returned non-zero, and we never cleaned up our own
    "struct dir_struct" either.
    
     * "pathbuf": When the read_directory() call followed by the
       free(pathbuf) was added in c819353 (Fix switching to a branch
       with D/F when current branch has file D., 2007-03-15) we didn't
       bother to free() before we called die().
    
       But when this code was later libified in 203a2fe (Allow callers
       of unpack_trees() to handle failure, 2008-02-07) we started to leak
       as we returned data to the caller. This fixes that memory leak,
       which can be observed under SANITIZE=leak with e.g. the
       "t1001-read-tree-m-2way.sh" test.
    
     * "struct dir_struct": We've leaked the dir_struct ever since this
       code was added back in c819353.
    
       When that commit was written there wasn't an equivalent of
       dir_clear(). Since it was added in 270be81 (dir.c: provide
       clear_directory() for reclaiming dir_struct memory, 2013-01-06)
       we've omitted freeing the memory allocated here.
    
       This memory leak could also be observed under SANITIZE=leak and the
       "t1001-read-tree-m-2way.sh" test.
    
    This makes all the test in "t1001-read-tree-m-2way.sh" pass under
    "GIT_TEST_PASSING_SANITIZE_LEAK=true", we'd previously die in tests
    25, 26 & 28.
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    avar authored and gitster committed Oct 7, 2021
    Copy the full SHA
    e5a917f View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2021

  1. sequencer: add a "goto cleanup" to do_reset()

    Restructure code that's mostly added in 9055e40 (sequencer:
    introduce new commands to reset the revision, 2018-04-25) to avoid
    code duplication, and to make freeing other resources easier in a
    subsequent commit.
    
    It's safe to initialize "tree_desc" to be zero'd out in order to
    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 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>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    avar authored and gitster committed Oct 13, 2021
    Copy the full SHA
    0c52cf8 View commit details
    Browse the repository at this point in the history
  2. sequencer: fix a memory leak in do_reset()

    Fix a memory leak introduced in 9055e40 (sequencer: introduce new
    commands to reset the revision, 2018-04-25), which called
    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
    even a single test pass.
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    avar authored and gitster committed Oct 13, 2021
    Copy the full SHA
    6e65854 View commit details
    Browse the repository at this point in the history