git/builtin
Ævar Arnfjörð Bjarmason b6046abc0c built-ins & libs & helpers: add/move destructors, fix leaks
Fix various leaks in built-ins, libraries and a test helper here we
were missing a call to strbuf_release(), string_list_clear() etc, or
were calling them after a potential "return".

Comments on individual changes:

- builtin/checkout.c: Fix a memory leak that was introduced in [1]. A
  sibling leak introduced in [2] was recently fixed in [3]. As with [3]
  we should be using the wt_status_state_free_buffers() API introduced
  in [4].

- builtin/repack.c: Fix a leak that's been here since this use of
  "strbuf_release()" was added in a1bbc6c017 (repack: rewrite the shell
  script in C, 2013-09-15). We don't use the variable for anything
  except this loop, so we can instead free it right afterwards.

- builtin/rev-parse: Fix a leak that's been here since this code was
  added in 21d4783538 (Add a parseopt mode to git-rev-parse to bring
  parse-options to shell scripts., 2007-11-04).

- builtin/stash.c: Fix a couple of leaks that have been here since
  this code was added in d4788af875 (stash: convert create to builtin,
  2019-02-25), we strbuf_release()'d only some of the "struct strbuf" we
  allocated earlier in the function, let's release all of them.

- ref-filter.c: Fix a leak in 482c119186 (gpg-interface: improve
  interface for parsing tags, 2021-02-11), we don't use the "payload"
  variable that we ask parse_signature() to populate for us, so let's
  free it.

- t/helper/test-fake-ssh.c: Fix a leak that's been here since this
  code was added in 3064d5a38c (mingw: fix t5601-clone.sh,
  2016-01-27). Let's free the "struct strbuf" as soon as we don't need
  it anymore.

1. c45f0f525d (switch: reject if some operation is in progress,
   2019-03-29)
2. 2708ce62d2 (branch: sort detached HEAD based on a flag,
   2021-01-07)
3. abcac2e19f (ref-filter.c: fix a leak in get_head_description,
   2022-09-25)
4. 962dd7ebc3 (wt-status: introduce wt_status_state_free_buffers(),
   2020-09-27).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-11-21 12:32:48 +09:00
..
add.c
am.c
annotate.c
apply.c
archive.c
bisect--helper.c
blame.c
branch.c Merge branch 'rj/branch-do-not-exit-with-minus-one-status' 2022-10-30 21:04:43 -04:00
bugreport.c
bundle.c Merge branch 'ds/bundle-uri-3' 2022-10-30 21:04:44 -04:00
cat-file.c
check-attr.c
check-ignore.c
check-mailmap.c
check-ref-format.c
checkout--worker.c
checkout-index.c
checkout.c built-ins & libs & helpers: add/move destructors, fix leaks 2022-11-21 12:32:48 +09:00
clean.c
clone.c
column.c
commit-graph.c
commit-tree.c
commit.c commit: discard partial cache before (re-)reading it 2022-11-21 12:32:48 +09:00
config.c
count-objects.c
credential-cache--daemon.c
credential-cache.c
credential-store.c
credential.c
describe.c
diagnose.c
diff-files.c
diff-index.c
diff-tree.c
diff.c
difftool.c
env--helper.c
fast-export.c
fast-import.c
fetch-pack.c
fetch.c
fmt-merge-msg.c
for-each-ref.c
for-each-repo.c
fsck.c
fsmonitor--daemon.c
gc.c
get-tar-commit-id.c
grep.c
hash-object.c
help.c
hook.c
index-pack.c
init-db.c
interpret-trailers.c
log.c
ls-files.c
ls-remote.c
ls-tree.c
mailinfo.c
mailsplit.c
merge-base.c
merge-file.c
merge-index.c
merge-ours.c
merge-recursive.c
merge-tree.c
merge.c {reset,merge}: call discard_index() before returning 2022-11-21 12:32:48 +09:00
mktag.c
mktree.c
multi-pack-index.c
mv.c
name-rev.c
notes.c
pack-objects.c
pack-redundant.c
pack-refs.c
patch-id.c
prune-packed.c
prune.c
pull.c
push.c
range-diff.c
read-tree.c
rebase.c built-ins & libs & helpers: add/move destructors, fix leaks 2022-11-21 12:32:48 +09:00
receive-pack.c
reflog.c
remote-ext.c
remote-fd.c
remote.c
repack.c built-ins & libs & helpers: add/move destructors, fix leaks 2022-11-21 12:32:48 +09:00
replace.c
rerere.c
reset.c {reset,merge}: call discard_index() before returning 2022-11-21 12:32:48 +09:00
rev-list.c
rev-parse.c built-ins & libs & helpers: add/move destructors, fix leaks 2022-11-21 12:32:48 +09:00
revert.c
rm.c
send-pack.c
shortlog.c
show-branch.c
show-index.c
show-ref.c
sparse-checkout.c
stash.c built-ins & libs & helpers: add/move destructors, fix leaks 2022-11-21 12:32:48 +09:00
stripspace.c
submodule--helper.c
symbolic-ref.c
tag.c
unpack-file.c
unpack-objects.c
update-index.c
update-ref.c
update-server-info.c
upload-archive.c
upload-pack.c
var.c
verify-commit.c
verify-pack.c
verify-tag.c
worktree.c
write-tree.c