]> git.ipfire.org Git - thirdparty/git.git/commitdiff
checkout: fix "branch info" memory leaks
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 16 Nov 2021 18:27:38 +0000 (19:27 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 18 Nov 2021 22:32:26 +0000 (14:32 -0800)
The "checkout" command is one of the main sources of leaks in the test
suite, let's fix the common ones by not leaking from the "struct
branch_info".

Doing this is rather straightforward, albeit verbose, we need to
xstrdup() constant strings going into the struct, and free() the ones
we clobber as we go along.

This also means that we can delete previous partial leak fixes in this
area, i.e. the "path_to_free" accounting added by 96ec7b1e708 (Convert
resolve_ref+xstrdup to new resolve_refdup function, 2011-12-13).

There was some discussion about whether "we should retain the "const
char *" here and cast at free() time, or have it be a "char *". Since
this is not a public API with any sort of API boundary let's use
"char *", as is already being done for the "refname" member of the
same struct.

The tests to mark as passing were found with:

    rm .prove; GIT_SKIP_TESTS=t0027 prove -j8 --state=save t[0-9]*.sh :: --immediate
    # apply & compile this change
    prove -j8 --state=failed :: --immediate

I.e. the ones that were newly passing when the --state=failed command
was run. I left out "t3040-subprojects-basic.sh" and
"t4131-apply-fake-ancestor.sh" to to optimization-level related
differences similar to the ones noted in[1], except that these would
be something the current 'linux-leaks' job would run into.

1. https://lore.kernel.org/git/cover-v3-0.6-00000000000-20211022T175227Z-avarab@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
36 files changed:
builtin/checkout.c
t/t0020-crlf.sh
t/t1005-read-tree-reset.sh
t/t1008-read-tree-overlay.sh
t/t1403-show-ref.sh
t/t1406-submodule-ref-store.sh
t/t1505-rev-parse-last.sh
t/t2007-checkout-symlink.sh
t/t2008-checkout-subdir.sh
t/t2009-checkout-statinfo.sh
t/t2010-checkout-ambiguous.sh
t/t2011-checkout-invalid-head.sh
t/t2014-checkout-switch.sh
t/t2017-checkout-orphan.sh
t/t2019-checkout-ambiguous-ref.sh
t/t2021-checkout-overwrite.sh
t/t2022-checkout-paths.sh
t/t2026-checkout-pathspec-file.sh
t/t2106-update-index-assume-unchanged.sh
t/t3040-subprojects-basic.sh
t/t3305-notes-fanout.sh
t/t3422-rebase-incompatible-options.sh
t/t4115-apply-symlink.sh
t/t4121-apply-diffs.sh
t/t4204-patch-id.sh
t/t5410-receive-pack-alternates.sh
t/t5609-clone-branch.sh
t/t6407-merge-binary.sh
t/t6414-merge-rename-nocruft.sh
t/t7113-post-index-change-hook.sh
t/t7509-commit-authorship.sh
t/t7815-grep-binary.sh
t/t9102-git-svn-deep-rmdir.sh
t/t9123-git-svn-rebuild-with-rewriteroot.sh
t/t9128-git-svn-cmd-branch.sh
t/t9167-git-svn-cmd-branch-subproject.sh

index cbf73b8c9f65ae2fdd1d96265bd4972aeaa9bd68..43d0275187fc8fcac9f7106fb511b08f527b488e 100644 (file)
@@ -91,8 +91,8 @@ struct checkout_opts {
 };
 
 struct branch_info {
-       const char *name; /* The short name used */
-       const char *path; /* The full name of a real branch */
+       char *name; /* The short name used */
+       char *path; /* The full name of a real branch */
        struct commit *commit; /* The named commit */
        char *refname; /* The full name of the ref being checked out. */
        struct object_id oid; /* The object ID of the commit being checked out. */
@@ -103,6 +103,14 @@ struct branch_info {
        char *checkout;
 };
 
+static void branch_info_release(struct branch_info *info)
+{
+       free(info->name);
+       free(info->path);
+       free(info->refname);
+       free(info->checkout);
+}
+
 static int post_checkout_hook(struct commit *old_commit, struct commit *new_commit,
                              int changed)
 {
@@ -688,9 +696,12 @@ static void setup_branch_path(struct branch_info *branch)
                repo_get_oid_committish(the_repository, branch->name, &branch->oid);
 
        strbuf_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL);
-       if (strcmp(buf.buf, branch->name))
+       if (strcmp(buf.buf, branch->name)) {
+               free(branch->name);
                branch->name = xstrdup(buf.buf);
+       }
        strbuf_splice(&buf, 0, 0, "refs/heads/", 11);
+       free(branch->path);
        branch->path = strbuf_detach(&buf, NULL);
 }
 
@@ -894,7 +905,9 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
                                      opts->new_branch_log,
                                      opts->quiet,
                                      opts->track);
-               new_branch_info->name = opts->new_branch;
+               free(new_branch_info->name);
+               free(new_branch_info->refname);
+               new_branch_info->name = xstrdup(opts->new_branch);
                setup_branch_path(new_branch_info);
        }
 
@@ -1062,8 +1075,7 @@ static int switch_branches(const struct checkout_opts *opts,
                           struct branch_info *new_branch_info)
 {
        int ret = 0;
-       struct branch_info old_branch_info;
-       void *path_to_free;
+       struct branch_info old_branch_info = { 0 };
        struct object_id rev;
        int flag, writeout_error = 0;
        int do_merge = 1;
@@ -1071,25 +1083,32 @@ static int switch_branches(const struct checkout_opts *opts,
        trace2_cmd_mode("branch");
 
        memset(&old_branch_info, 0, sizeof(old_branch_info));
-       old_branch_info.path = path_to_free = resolve_refdup("HEAD", 0, &rev, &flag);
+       old_branch_info.path = resolve_refdup("HEAD", 0, &rev, &flag);
        if (old_branch_info.path)
                old_branch_info.commit = lookup_commit_reference_gently(the_repository, &rev, 1);
        if (!(flag & REF_ISSYMREF))
-               old_branch_info.path = NULL;
+               FREE_AND_NULL(old_branch_info.path);
 
-       if (old_branch_info.path)
-               skip_prefix(old_branch_info.path, "refs/heads/", &old_branch_info.name);
+       if (old_branch_info.path) {
+               const char *const prefix = "refs/heads/";
+               const char *p;
+               if (skip_prefix(old_branch_info.path, prefix, &p))
+                       old_branch_info.name = xstrdup(p);
+               else
+                       BUG("should be able to skip past '%s' in '%s'!",
+                           prefix, old_branch_info.path);
+       }
 
        if (opts->new_orphan_branch && opts->orphan_from_empty_tree) {
                if (new_branch_info->name)
                        BUG("'switch --orphan' should never accept a commit as starting point");
                new_branch_info->commit = NULL;
-               new_branch_info->name = "(empty)";
+               new_branch_info->name = xstrdup("(empty)");
                do_merge = 1;
        }
 
        if (!new_branch_info->name) {
-               new_branch_info->name = "HEAD";
+               new_branch_info->name = xstrdup("HEAD");
                new_branch_info->commit = old_branch_info.commit;
                if (!new_branch_info->commit)
                        die(_("You are on a branch yet to be born"));
@@ -1102,7 +1121,7 @@ static int switch_branches(const struct checkout_opts *opts,
        if (do_merge) {
                ret = merge_working_tree(opts, &old_branch_info, new_branch_info, &writeout_error);
                if (ret) {
-                       free(path_to_free);
+                       branch_info_release(&old_branch_info);
                        return ret;
                }
        }
@@ -1113,7 +1132,8 @@ static int switch_branches(const struct checkout_opts *opts,
        update_refs_for_switch(opts, &old_branch_info, new_branch_info);
 
        ret = post_checkout_hook(old_branch_info.commit, new_branch_info->commit, 1);
-       free(path_to_free);
+       branch_info_release(&old_branch_info);
+
        return ret || writeout_error;
 }
 
@@ -1145,16 +1165,15 @@ static void setup_new_branch_info_and_source_tree(
        struct tree **source_tree = &opts->source_tree;
        struct object_id branch_rev;
 
-       new_branch_info->name = arg;
+       new_branch_info->name = xstrdup(arg);
        setup_branch_path(new_branch_info);
 
        if (!check_refname_format(new_branch_info->path, 0) &&
            !read_ref(new_branch_info->path, &branch_rev))
                oidcpy(rev, &branch_rev);
-       else {
-               free((char *)new_branch_info->path);
-               new_branch_info->path = NULL; /* not an existing branch */
-       }
+       else
+               /* not an existing branch */
+               FREE_AND_NULL(new_branch_info->path);
 
        new_branch_info->commit = lookup_commit_reference_gently(the_repository, rev, 1);
        if (!new_branch_info->commit) {
@@ -1574,12 +1593,11 @@ static char cb_option = 'b';
 
 static int checkout_main(int argc, const char **argv, const char *prefix,
                         struct checkout_opts *opts, struct option *options,
-                        const char * const usagestr[])
+                        const char * const usagestr[],
+                        struct branch_info *new_branch_info)
 {
-       struct branch_info new_branch_info;
        int parseopt_flags = 0;
 
-       memset(&new_branch_info, 0, sizeof(new_branch_info));
        opts->overwrite_ignore = 1;
        opts->prefix = prefix;
        opts->show_progress = -1;
@@ -1688,7 +1706,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
                        opts->track == BRANCH_TRACK_UNSPECIFIED &&
                        !opts->new_branch;
                int n = parse_branchname_arg(argc, argv, dwim_ok,
-                                            &new_branch_info, opts, &rev);
+                                            new_branch_info, opts, &rev);
                argv += n;
                argc -= n;
        } else if (!opts->accept_ref && opts->from_treeish) {
@@ -1697,7 +1715,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
                if (get_oid_mb(opts->from_treeish, &rev))
                        die(_("could not resolve %s"), opts->from_treeish);
 
-               setup_new_branch_info_and_source_tree(&new_branch_info,
+               setup_new_branch_info_and_source_tree(new_branch_info,
                                                      opts, &rev,
                                                      opts->from_treeish);
 
@@ -1717,7 +1735,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
                 * Try to give more helpful suggestion.
                 * new_branch && argc > 1 will be caught later.
                 */
-               if (opts->new_branch && argc == 1 && !new_branch_info.commit)
+               if (opts->new_branch && argc == 1 && !new_branch_info->commit)
                        die(_("'%s' is not a commit and a branch '%s' cannot be created from it"),
                                argv[0], opts->new_branch);
 
@@ -1766,11 +1784,10 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
                strbuf_release(&buf);
        }
 
-       UNLEAK(opts);
        if (opts->patch_mode || opts->pathspec.nr)
-               return checkout_paths(opts, &new_branch_info);
+               return checkout_paths(opts, new_branch_info);
        else
-               return checkout_branch(opts, &new_branch_info);
+               return checkout_branch(opts, new_branch_info);
 }
 
 int cmd_checkout(int argc, const char **argv, const char *prefix)
@@ -1789,6 +1806,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
        int ret;
+       struct branch_info new_branch_info = { 0 };
 
        memset(&opts, 0, sizeof(opts));
        opts.dwim_new_local_branch = 1;
@@ -1819,7 +1837,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
        options = add_checkout_path_options(&opts, options);
 
        ret = checkout_main(argc, argv, prefix, &opts,
-                           options, checkout_usage);
+                           options, checkout_usage, &new_branch_info);
+       branch_info_release(&new_branch_info);
+       clear_pathspec(&opts.pathspec);
        FREE_AND_NULL(options);
        return ret;
 }
@@ -1840,6 +1860,7 @@ int cmd_switch(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
        int ret;
+       struct branch_info new_branch_info = { 0 };
 
        memset(&opts, 0, sizeof(opts));
        opts.dwim_new_local_branch = 1;
@@ -1859,7 +1880,8 @@ int cmd_switch(int argc, const char **argv, const char *prefix)
        cb_option = 'c';
 
        ret = checkout_main(argc, argv, prefix, &opts,
-                           options, switch_branch_usage);
+                           options, switch_branch_usage, &new_branch_info);
+       branch_info_release(&new_branch_info);
        FREE_AND_NULL(options);
        return ret;
 }
@@ -1881,6 +1903,7 @@ int cmd_restore(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
        int ret;
+       struct branch_info new_branch_info = { 0 };
 
        memset(&opts, 0, sizeof(opts));
        opts.accept_ref = 0;
@@ -1896,7 +1919,8 @@ int cmd_restore(int argc, const char **argv, const char *prefix)
        options = add_checkout_path_options(&opts, options);
 
        ret = checkout_main(argc, argv, prefix, &opts,
-                           options, restore_usage);
+                           options, restore_usage, &new_branch_info);
+       branch_info_release(&new_branch_info);
        FREE_AND_NULL(options);
        return ret;
 }
index f25ae8b5e1f34dd8e58bbe65ee171cbf5c8aa14b..4125ab8b88403d2924e46e6c1fe0658e1ec8dba9 100755 (executable)
@@ -5,6 +5,7 @@ test_description='CRLF conversion'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 has_cr() {
index 83b09e1310676cc4ca092ff30c6da50aa6e635fd..12e30d77d096d5108396f90ecd4f9088c0f27413 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='read-tree -u --reset'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-read-tree.sh
 
index 4512fb0b6e68b4ac12e54610441fe1f2de89ea0c..ad5936e54d1f73ed46c1066600f273f0847ca673 100755 (executable)
@@ -5,6 +5,7 @@ test_description='test multi-tree read-tree without merging'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-read-tree.sh
 
index 17d3cc14050695d42bc19d043e9c3c5f4ab000e4..4d261e80c6ff3117b06f3b383c45074aed3effdf 100755 (executable)
@@ -4,6 +4,7 @@ test_description='show-ref'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success setup '
index 0a87058971ee3f601f928a1d3078c25ac0a60ce2..3c19edcf30bdc07c3c68a0b8b1df41744abfaf60 100755 (executable)
@@ -5,6 +5,7 @@ test_description='test submodule ref store api'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 RUN="test-tool ref-store submodule:sub"
index 2803ca9489c7c6bc2accd85c62ec52805ce2bce3..4a5758f08a8b2f38bc98e6ac4e26cfa36713780d 100755 (executable)
@@ -5,6 +5,7 @@ test_description='test @{-N} syntax'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 
index 6f0b90ce1271ec49f6fd78016c5f3cb082053674..bd9e9e7530da06da9eb3fc6ce103b82196625d23 100755 (executable)
@@ -7,6 +7,7 @@ test_description='git checkout to switch between branches with symlink<->dir'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success setup '
index eadb9434ae764cc0ca57085a6ce28dd5bee4bb77..8a518a44ea2d2a65f6ee2d9d88c5a8233476c902 100755 (executable)
@@ -4,6 +4,7 @@
 
 test_description='git checkout from subdirectories'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success setup '
index b0540636ae387104edae67cd7baa74949f7f5ffd..71195dd28f2258d3286cc478967b0319ae58b143 100755 (executable)
@@ -5,6 +5,7 @@ test_description='checkout should leave clean stat info'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index 6e8757387d15fc88afbc55f41633361875a2fde3..9d4b37526a326396fc334580350ff3cef3102b1e 100755 (executable)
@@ -5,6 +5,7 @@ test_description='checkout and pathspecs/refspecs ambiguities'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index e52022e152290b4e31ee837effc6e468c76f1eda..d9997e7b6b41a19537eed0bd512be1e8c78dc3d6 100755 (executable)
@@ -5,6 +5,7 @@ test_description='checkout switching away from an invalid branch'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index ccfb1471135396cfc2a2dfca10697b2778c79445..c138bdde4fea1536a06137c68ab100b6b0d1f49b 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='Peter MacMillan'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success setup '
index 88d6992a5e1f95978e15ab5fc5d1fad00e2b890a..f3371e264605626b163b39a240b91717613a0826 100755 (executable)
@@ -10,6 +10,7 @@ Main Tests for --orphan functionality.'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 TEST_FILE=foo
index b99d5192a96ec77ef6a99cb86518375c447b48a9..2c8c926b4d73a32a23380ec347e6c89c5a8e9657 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='checkout handling of ambiguous (branch/tag) refs'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup ambiguous refs' '
index 660132ff8d5919b1af69010ff4122b1f18d6a742..713c3fa6038632bff43ef8344be2d4a6a73cb32e 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='checkout must not overwrite an untracked objects'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index c49ba7f9bd4fe0c6f8f88fbe5a0722b2d6337ac7..f1b709d58bef0080c1e8067b4b6e725b8141d027 100755 (executable)
@@ -4,6 +4,7 @@ test_description='checkout $tree -- $paths'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success setup '
index 43d31d7948536d2219104c2e6694d447101599a2..9db11f86dd6e901cfb8f3241da3ee5f1710aa1c4 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='checkout --pathspec-from-file'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_tick
index 2d450daf5c8a441acda6eda604e2e28f749bc2dd..d943ddf47e08f98b20a1f3365dca594815e06ea5 100755 (executable)
@@ -3,6 +3,7 @@
 test_description='git update-index --assume-unchanged test.
 '
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index 6abdcbbc94ab46944123f817700cc1ea36ae831b..bd65dfcffc7b80e6dceb1603a189d07ab0d4b0b3 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='Basic subproject functionality'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup: create superproject' '
index 94c1b02251c28e68778d8a5c4f1298ec1a84dc52..960d0587e189a57049d64688c995bff580ac42ef 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='Test that adding/removing many notes triggers automatic fanout restructuring'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 path_has_fanout() {
index eb0a3d9d48738375bfe74c199aa5e8116d30dd3d..6dabb05a2ad993d0d4d1f41c619f517038f7134f 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='test if rebase detects and aborts on incompatible options'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index 872fcda6cb6dce98ec360c41cb6ae1220193ca48..d0f3edef54acf6247a034041eb234c73f67d5762 100755 (executable)
@@ -7,6 +7,7 @@ test_description='git apply symlinks and partial files
 
 '
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success setup '
index b45454aaf4bfe684ad3099db20b36ad57be2421b..a80cec9d1193be70416eb46257d5ba6fcea30952 100755 (executable)
@@ -4,6 +4,7 @@ test_description='git apply for contextually independent diffs'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 echo '1
index f120857c20a2558b905dd9c55fa43099d7095a1a..e78d8097f39690ee094f601344d104a6e3a4ce09 100755 (executable)
@@ -5,6 +5,7 @@ test_description='git patch-id'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index 0b28e4e452fe7e6da3269ff55e6e3b4f0fb91cea..7a45d4c311ed345fc0126355642e9e1e4e68d292 100755 (executable)
@@ -5,6 +5,7 @@ test_description='git receive-pack with alternate ref filtering'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index f86a674a0321e7e39f4df16461d5da0eab84969b..252e1f7c20f2b86b3a276a6bfd7adc9ca14d4909 100755 (executable)
@@ -4,6 +4,7 @@ test_description='clone --branch option'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 check_HEAD() {
index d4273f2575b24728a0fe6ff838ec13bbde2f70a2..e34676c204b41a76b3c90519386e275db42c3b55 100755 (executable)
@@ -5,6 +5,7 @@ test_description='ask merge-recursive to merge binary files'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success setup '
index d7e3c1fa6e634878e24edf0cf9a71e4f07c4733e..69fc1c9e697a9d86a5d29b2fa99aafbc78a79a6f 100755 (executable)
@@ -4,6 +4,7 @@ test_description='Merge-recursive merging renames'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index 688fa995c9164b7e58c6ac81cafa949b07d68199..a21781d68a1abf91bf2d34d029a1c90732991f2b 100755 (executable)
@@ -5,6 +5,7 @@ test_description='post index change hook'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index d568593382cfb062b629f07fb6dcf1a23baeb8b9..21c668f75ed7345430f88f65b7e9072a873b9c42 100755 (executable)
@@ -5,6 +5,7 @@
 
 test_description='commit tests of various authorhip options. '
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 author_header () {
index 90ebb64f46ebfaeed11c0a0d36cf015e415423b9..ac871287c03a9facc3b6530ce82b3c40ed8d9cad 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='git grep in binary files'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' "
index 66cd51102c8b6f93e4614a13a20bb02dcb0633e5..7b2049caa0ce496f5c1b07152a3092363fb71c64 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 test_description='git svn rmdir'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-git-svn.sh
 
 test_expect_success 'initialize repo' '
index ead404589eb622edd30adda06ad9684517b7e1f4..3320b1f39cf65ca770a6257e62779eb397eda8c2 100755 (executable)
@@ -5,6 +5,7 @@
 
 test_description='git svn respects rewriteRoot during rebuild'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-git-svn.sh
 
 mkdir import
index 4e95f791db1ff2be9781cf965d5a12a86c5a8ce3..9871f5abc933b8f86b33f1efcbea5e1966b55eee 100755 (executable)
@@ -4,6 +4,8 @@
 #
 
 test_description='git svn partial-rebuild tests'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-git-svn.sh
 
 test_expect_success 'initialize svnrepo' '
index ba35fc06fcee2e2dad41db682b29ede932a2e96f..d9fd111c1052a251b918ad7e66f30e52c2b4574c 100755 (executable)
@@ -4,6 +4,8 @@
 #
 
 test_description='git svn branch for subproject clones'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-git-svn.sh
 
 test_expect_success 'initialize svnrepo' '