diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-04-08 01:54:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-04-08 01:54:08 +0200 |
commit | 642a40019c99a42f5f4ed4f3e52b9ab92cd75fe7 (patch) | |
tree | 03da4a9395b7d4eda1517fb783e246cfeb80c965 /builtin/remote.c | |
parent | The sixth batch (diff) | |
parent | transport: also free remote_refs in transport_disconnect() (diff) | |
download | git-642a40019c99a42f5f4ed4f3e52b9ab92cd75fe7.tar.xz git-642a40019c99a42f5f4ed4f3e52b9ab92cd75fe7.zip |
Merge branch 'ah/plugleaks'
Plug or annotate remaining leaks that trigger while running the
very basic set of tests.
* ah/plugleaks:
transport: also free remote_refs in transport_disconnect()
parse-options: don't leak alias help messages
parse-options: convert bitfield values to use binary shift
init-db: silence template_dir leak when converting to absolute path
init: remove git_init_db_config() while fixing leaks
worktree: fix leak in dwim_branch()
clone: free or UNLEAK further pointers when finished
reset: free instead of leaking unneeded ref
symbolic-ref: don't leak shortened refname in check_symref()
Diffstat (limited to 'builtin/remote.c')
-rw-r--r-- | builtin/remote.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/remote.c b/builtin/remote.c index 717b662d45..7f88e6ce9d 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -938,9 +938,6 @@ static int get_remote_ref_states(const char *name, struct ref_states *states, int query) { - struct transport *transport; - const struct ref *remote_refs; - states->remote = remote_get(name); if (!states->remote) return error(_("No such remote: '%s'"), name); @@ -948,10 +945,12 @@ static int get_remote_ref_states(const char *name, read_branches(); if (query) { + struct transport *transport; + const struct ref *remote_refs; + transport = transport_get(states->remote, states->remote->url_nr > 0 ? states->remote->url[0] : NULL); remote_refs = transport_get_remote_refs(transport, NULL); - transport_disconnect(transport); states->queried = 1; if (query & GET_REF_STATES) @@ -960,6 +959,7 @@ static int get_remote_ref_states(const char *name, get_head_names(remote_refs, states); if (query & GET_PUSH_REF_STATES) get_push_ref_states(remote_refs, states); + transport_disconnect(transport); } else { for_each_ref(append_ref_to_tracked_list, states); string_list_sort(&states->tracked); |