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: 5a4f8381b68b39e1a39e78039ddb2c415927cb12
Choose a base ref
...
head repository: git/git
compare: 465028e0e25518bfff8b83057775cb6b2df2aade
Choose a head ref
  • 8 commits
  • 30 files changed
  • 2 contributors

Commits on Oct 7, 2021

  1. Merge branch 'ab/sanitize-leak-ci' into ab/mark-leak-free-tests-more

    * 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
    6cb3deb View commit details
    Browse the repository at this point in the history
  2. tests: fix a memory leak in test-prio-queue.c

    Fix a memory leak in t/helper/test-prio-queue.c, the lack of freeing
    the memory with clear_prio_queue() has been there ever since this code
    was originally added in b4b594a (prio-queue: priority queue of
    pointers to structs, 2013-06-06).
    
    By fixing this leak we can cleanly run t0009-prio-queue.sh under
    SANITIZE=leak, so annotate it as such with
    TEST_PASSES_SANITIZE_LEAK=true.
    
    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
    6a75658 View commit details
    Browse the repository at this point in the history
  3. tests: fix a memory leak in test-parse-options.c

    Fix a memory leak in t/helper/test-parse-options.c, we were not
    freeing the allocated "struct string_list" or its items. Let's move
    the declaration of the "list" variable into the cmd__parse_options()
    and release it at the end.
    
    In c8ba163 (parse-options: add OPT_STRING_LIST helper, 2011-06-09)
    the "list" variable was added, and later on in
    c8ba163 (parse-options: add OPT_STRING_LIST helper, 2011-06-09)
    the "expect" was added.
    
    The "list" variable was last touched in 2721ce2 (use string_list
    initializer consistently, 2016-06-13), but it was still left at the
    static scope, it's better to move it to the function for consistency.
    
    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
    c0b80e0 View commit details
    Browse the repository at this point in the history
  4. tests: fix a memory leak in test-oidtree.c

    Fix a memory leak in t/helper/test-oidtree.c, we were not freeing the
    "struct strbuf" we used for the stdin input we parsed. This leak has
    been here ever since 92d8ed8 (oidtree: a crit-bit tree for
    odb_loose_cache, 2021-07-07).
    
    Now that it's fixed we can declare that t0069-oidtree.sh will pass
    under GIT_TEST_PASSING_SANITIZE_LEAK=true.
    
    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
    926d233 View commit details
    Browse the repository at this point in the history
  5. tests: fix test-oid-array leak, test in SANITIZE=leak

    Fix a trivial memory leak present ever since 38d905b (sha1-array:
    add test-sha1-array and basic tests, 2014-10-01), now that that's
    fixed we can test this under GIT_TEST_PASSING_SANITIZE_LEAK=true.
    
    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
    6ad66ab View commit details
    Browse the repository at this point in the history
  6. ls-files: fix a trivial dir_clear() leak

    Fix an edge case that was missed when the dir_clear() call was added
    in eceba53 (dir: fix problematic API to avoid memory leaks,
    2020-08-18), we need to also clean up when we're about to exit with
    non-zero.
    
    That commit says, on the topic of the dir_clear() API and UNLEAK():
    
        [...]two of them clearly thought about leaks since they had an
        UNLEAK(dir) directive, which to me suggests that the method to
        free the data was too unclear.
    
    I think that 0e5bba5 (add UNLEAK annotation for reducing leak
    false positives, 2017-09-08) which added the UNLEAK() makes it clear
    that that wasn't the case, rather it was the desire to avoid the
    complexity of freeing the memory at the end of the program.
    
    This does add a bit of complexity, but I think it's worth it to just
    fix these leaks when it's easy in built-ins. It allows them to serve
    as canaries for underlying APIs that shouldn't be leaking, it
    encourages us to make those freeing APIs nicer for all their users,
    and it prevents other leaking regressions by being able to mark the
    entire test as TEST_PASSES_SANITIZE_LEAK=true.
    
    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
    eab4ac6 View commit details
    Browse the repository at this point in the history
  7. ls-files: add missing string_list_clear()

    Fix a memory leak that's been here ever since 72aeb18 (clean.c,
    ls-files.c: respect encapsulation of exclude_list_groups, 2013-01-16),
    we dup'd the argument in option_parse_exclude(), but never freed the
    string_list.
    
    This makes almost all of t3001-ls-files-others-exclude.sh pass (it had
    a lot of failures before). Let's mark it as passing with
    TEST_PASSES_SANITIZE_LEAK=true, and then exclude the tests that still
    failed with a !SANITIZE_LEAK prerequisite check until we fix those
    leaks. We can still see the failed tests under
    GIT_TEST_FAIL_PREREQS=true.
    
    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
    272f0a5 View commit details
    Browse the repository at this point in the history
  8. merge: add missing strbuf_release()

    We strbuf_reset() this "struct strbuf" in a loop earlier, but never
    freed it. Plugs a memory leak that's been here ever since this code
    got introduced in 1c7b76b (Build in merge, 2008-07-07).
    
    This takes us from 68 failed tests in "t7600-merge.sh" to 59 under
    SANITIZE=leak, and makes "t7604-merge-custom-message.sh" 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 7, 2021
    Copy the full SHA
    465028e View commit details
    Browse the repository at this point in the history