git/builtin
Patrick Steinhardt 7eb6f02c55 builtin/push: fix leaking refspec query result
When appending a refspec via `refspec_append_mapped()` we leak the
result of `query_refspecs()`. The overall logic around refspec queries
is quite weird, as callers are expected to either set the `src` or `dst`
pointers, and then the (allocated) result will be in the respective
other struct member.

As we have the `src` member set, plugging the memory leak is thus as
easy as just freeing the `dst` member. While at it, use designated
initializers to initialize the structure.

This leak was exposed by t5516, but fixing it is not sufficient to make
the whole test suite leak free.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-09-05 08:49:10 -07:00
..
add.c add-i: finally retire add.interactive.useBuiltin 2024-06-05 14:53:26 -07:00
am.c hooks: remove implicit dependency on `the_repository` 2024-08-13 10:01:01 -07:00
annotate.c
apply.c apply: fix uninitialized hash function 2024-05-21 09:07:48 -07:00
archive.c Merge branch 'ps/leakfixes-more' 2024-07-08 14:53:10 -07:00
bisect.c refs: add referent to each_ref_fn 2024-08-09 08:47:34 -07:00
blame.c Merge branch 'ps/leakfixes-more' 2024-07-08 14:53:10 -07:00
branch.c config: pass repo to functions that rename or copy sections 2024-08-13 10:01:04 -07:00
bugreport.c hooks: remove implicit dependency on `the_repository` 2024-08-13 10:01:01 -07:00
bundle.c builtin/bundle: have unbundle check for repo before opening its bundle 2024-08-13 10:26:20 -07:00
cat-file.c object-name: free leaking object contexts 2024-06-11 13:15:05 -07:00
check-attr.c builtin: stop using `the_index` 2024-04-18 12:30:42 -07:00
check-ignore.c global: improve const correctness when assigning string constants 2024-06-07 10:30:48 -07:00
check-mailmap.c
check-ref-format.c
checkout--worker.c
checkout-index.c builtin: stop using `the_index` 2024-04-18 12:30:42 -07:00
checkout.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
clean.c builtin: stop using `the_index` 2024-04-18 12:30:42 -07:00
clone.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
column.c
commit-graph.c
commit-tree.c commit: fix leaking parents when calling `commit_tree_extended()` 2024-06-11 13:15:07 -07:00
commit.c config: fix leaking comment character config 2024-08-14 10:07:58 -07:00
config.c config: pass repo to functions that rename or copy sections 2024-08-13 10:01:04 -07:00
count-objects.c path: stop relying on `the_repository` when reporting garbage 2024-08-13 10:01:01 -07:00
credential-cache--daemon.c Merge branch 'bc/credential-scheme-enhancement' 2024-05-08 10:18:44 -07:00
credential-cache.c builtin/credential-cache: fix trivial leaks 2024-08-01 08:47:37 -07:00
credential-store.c builtin/credential-store: fix leaking credential 2024-08-01 08:47:36 -07:00
credential.c builtin/credential: clear credential before exit 2024-05-27 11:20:01 -07:00
describe.c Merge branch 'jc/refs-symref-referent' 2024-08-15 13:22:15 -07:00
diagnose.c global: improve const correctness when assigning string constants 2024-06-07 10:30:48 -07:00
diff-files.c
diff-index.c
diff-tree.c Merge branch 'xx/diff-tree-remerge-diff-fix' 2024-08-15 13:22:16 -07:00
diff.c builtin/diff: free symmetric diff members 2024-08-14 10:08:02 -07:00
difftool.c Merge branch 'ps/leakfixes-more' 2024-07-08 14:53:10 -07:00
fast-export.c builtin/fast-export: plug leaking tag names 2024-08-14 10:07:59 -07:00
fast-import.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
fetch-pack.c hash: require hash algorithm in `oidread()` and `oidclr()` 2024-06-14 10:26:32 -07:00
fetch.c refs: add referent to each_ref_fn 2024-08-09 08:47:34 -07:00
fmt-merge-msg.c parse-options: fix leaks for users of OPT_FILENAME 2024-06-11 13:15:04 -07:00
for-each-ref.c ref-filter: properly distinuish pseudo and root refs 2024-05-15 07:30:52 -07:00
for-each-repo.c for-each-repo: optionally keep going on an error 2024-04-24 10:46:03 -07:00
fsck.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
fsmonitor--daemon.c
gc.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
get-tar-commit-id.c set errno=0 before strtoX calls 2024-08-05 10:59:20 -07:00
grep.c object-name: free leaking object contexts 2024-06-11 13:15:05 -07:00
hash-object.c builtin/hash-object: fix uninitialized hash function 2024-05-21 09:05:13 -07:00
help.c
hook.c hooks: remove implicit dependency on `the_repository` 2024-08-13 10:01:01 -07:00
index-pack.c hash: require hash algorithm in `oidread()` and `oidclr()` 2024-06-14 10:26:32 -07:00
init-db.c refs: convert ref storage format to an enum 2024-06-06 09:04:31 -07:00
interpret-trailers.c Merge branch 'la/hide-trailer-info' 2024-05-23 11:04:27 -07:00
log.c builtin/log: fix leak when showing converted blob contents 2024-08-14 10:08:01 -07:00
ls-files.c
ls-remote.c Merge branch 'ps/ls-remote-out-of-repo-fix' 2024-08-14 14:54:49 -07:00
ls-tree.c object-name: free leaking object contexts 2024-06-11 13:15:05 -07:00
mailinfo.c
mailsplit.c global: improve const correctness when assigning string constants 2024-06-07 10:30:48 -07:00
merge-base.c
merge-file.c
merge-index.c builtin: stop using `the_index` 2024-04-18 12:30:42 -07:00
merge-ours.c
merge-recursive.c merge-recursive: honor diff.algorithm 2024-07-13 18:10:49 -07:00
merge-tree.c merge-recursive: honor diff.algorithm 2024-07-13 18:10:49 -07:00
merge.c hooks: remove implicit dependency on `the_repository` 2024-08-13 10:01:01 -07:00
mktag.c fsck: make "fsck_error" callback generic 2024-08-08 09:36:52 -07:00
mktree.c
multi-pack-index.c midx: implement support for writing incremental MIDX chains 2024-08-06 12:01:39 -07:00
mv.c mv: replace src_dir with a strvec 2024-05-30 08:55:29 -07:00
name-rev.c Merge branch 'jc/refs-symref-referent' 2024-08-15 13:22:15 -07:00
notes.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
pack-objects.c refs: add referent to each_ref_fn 2024-08-09 08:47:34 -07:00
pack-redundant.c hash: require hash algorithm in `oidread()` and `oidclr()` 2024-06-14 10:26:32 -07:00
pack-refs.c
patch-id.c Merge branch 'jc/patch-id' 2024-08-14 14:54:53 -07:00
prune-packed.c
prune.c
pull.c Merge branch 'ps/use-the-repository' 2024-07-02 09:59:00 -07:00
push.c builtin/push: fix leaking refspec query result 2024-09-05 08:49:10 -07:00
range-diff.c
read-tree.c builtin: stop using `the_index` 2024-04-18 12:30:42 -07:00
rebase.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
receive-pack.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
reflog.c refs: remove `dwim_log()` 2024-05-17 10:33:39 -07:00
refs.c builtin/refs: add verify subcommand 2024-08-08 09:36:53 -07:00
remote-ext.c
remote-fd.c
remote.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
repack.c Merge branch 'tb/incremental-midx-part-1' 2024-08-19 11:07:37 -07:00
replace.c refs: add referent to each_ref_fn 2024-08-09 08:47:34 -07:00
replay.c Merge branch 'ps/leakfixes-part-3' 2024-08-14 14:54:47 -07:00
rerere.c builtin/rerere: fix various trivial memory leaks 2024-08-01 08:47:37 -07:00
reset.c Merge branch 'ps/refs-without-the-repository' 2024-05-16 10:10:14 -07:00
rev-list.c builtin/rev-list: fix leaking bitmap index when calculating disk usage 2024-06-11 13:15:05 -07:00
rev-parse.c Merge branch 'jc/refs-symref-referent' 2024-08-15 13:22:15 -07:00
revert.c global: improve const correctness when assigning string constants 2024-06-07 10:30:48 -07:00
rm.c hash: require hash algorithm in `oidread()` and `oidclr()` 2024-06-14 10:26:32 -07:00
send-pack.c send-pack: always allocate receive status 2024-06-07 10:30:53 -07:00
shortlog.c builtin/shortlog: fix various trivial memory leaks 2024-08-01 08:47:37 -07:00
show-branch.c Merge branch 'jc/refs-symref-referent' 2024-08-15 13:22:15 -07:00
show-index.c
show-ref.c Merge branch 'jc/refs-symref-referent' 2024-08-15 13:22:15 -07:00
sparse-checkout.c Merge branch 'ps/leakfixes-more' 2024-07-08 14:53:10 -07:00
stash.c Merge branch 'ps/stash-keep-untrack-empty-fix' 2024-08-23 09:02:36 -07:00
stripspace.c
submodule--helper.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
symbolic-ref.c Merge branch 'kn/ref-transaction-symref' 2024-05-20 11:20:04 -07:00
tag.c hash: require hash algorithm in `oidread()` and `oidclr()` 2024-06-14 10:26:32 -07:00
unpack-file.c
unpack-objects.c hash: require hash algorithm in `oidread()` and `oidclr()` 2024-06-14 10:26:32 -07:00
update-index.c config: pass repo to `git_config_get_split_index()` 2024-08-13 10:01:03 -07:00
update-ref.c Merge branch 'ps/use-the-repository' 2024-07-02 09:59:00 -07:00
update-server-info.c
upload-archive.c
upload-pack.c Sync with 2.44.1 2024-04-29 20:42:30 +02:00
var.c var(win32): do report the GIT_SHELL_PATH that is actually used 2024-07-13 16:23:37 -07:00
verify-commit.c
verify-pack.c
verify-tag.c
worktree.c Merge branch 'ps/config-wo-the-repository' 2024-08-23 09:02:34 -07:00
write-tree.c builtin: stop using `the_index` 2024-04-18 12:30:42 -07:00