]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ab/various-leak-fixes'
authorJunio C Hamano <gitster@pobox.com>
Wed, 22 Feb 2023 22:55:45 +0000 (14:55 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Feb 2023 22:55:45 +0000 (14:55 -0800)
Leak fixes.

* ab/various-leak-fixes:
  push: free_refs() the "local_refs" in set_refspecs()
  push: refactor refspec_append_mapped() for subsequent leak-fix
  receive-pack: release the linked "struct command *" list
  grep API: plug memory leaks by freeing "header_list"
  grep.c: refactor free_grep_patterns()
  builtin/merge.c: free "&buf" on "Your local changes..." error
  builtin/merge.c: use fixed strings, not "strbuf", fix leak
  show-branch: free() allocated "head" before return
  commit-graph: fix a parse_options_concat() leak
  http-backend.c: fix cmd_main() memory leak, refactor reg{exec,free}()
  http-backend.c: fix "dir" and "cmd_arg" leaks in cmd_main()
  worktree: fix a trivial leak in prune_worktrees()
  repack: fix leaks on error with "goto cleanup"
  name-rev: don't xstrdup() an already dup'd string
  various: add missing clear_pathspec(), fix leaks
  clone: use free() instead of UNLEAK()
  commit-graph: use free_commit_graph() instead of UNLEAK()
  bundle.c: don't leak the "args" in the "struct child_process"
  tests: mark tests as passing with SANITIZE=leak

1  2 
builtin/clean.c
builtin/clone.c
builtin/merge.c
builtin/name-rev.c
builtin/reset.c
builtin/stash.c
bundle.c
grep.c
t/t5604-clone-reference.sh

diff --cc builtin/clean.c
Simple merge
diff --cc builtin/clone.c
Simple merge
diff --cc builtin/merge.c
Simple merge
Simple merge
diff --cc builtin/reset.c
index 4b59aa9aeae13dc13384635003d276e237668c0e,e9c10618cd32384c15b55dfcf70dc437f3cd9ca6..0697fa89de22414a58cce94b5f129c9e97d03fa1
@@@ -391,8 -390,8 +391,9 @@@ int cmd_reset(int argc, const char **ar
                if (reset_type != NONE)
                        die(_("options '%s' and '%s' cannot be used together"), "--patch", "--{hard,mixed,soft}");
                trace2_cmd_mode("patch-interactive");
-               return !!run_add_p(the_repository, ADD_P_RESET, rev,
 -              update_ref_status = run_add_interactive(rev, "--patch=reset", &pathspec);
++              update_ref_status = !!run_add_p(the_repository, ADD_P_RESET, rev,
 +                                 &pathspec);
+               goto cleanup;
        }
  
        /* git reset tree [--] paths... can be used to
diff --cc builtin/stash.c
Simple merge
diff --cc bundle.c
Simple merge
diff --cc grep.c
Simple merge
Simple merge