summaryrefslogtreecommitdiffstats
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-09-20 20:16:30 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-20 20:16:30 +0200
commit16c0906e8cd9b32b95dfe68058bcdaad3e4458e4 (patch)
tree5eb2fce820151a347514e6a60c9162c10184256e /remote.c
parentMerge branch 'pw/rebase-autostash-fix' (diff)
parentbuiltin/repack: fix leaking keep-pack list (diff)
downloadgit-16c0906e8cd9b32b95dfe68058bcdaad3e4458e4.tar.xz
git-16c0906e8cd9b32b95dfe68058bcdaad3e4458e4.zip
Merge branch 'ps/leakfixes-part-6'
More leakfixes. * ps/leakfixes-part-6: (22 commits) builtin/repack: fix leaking keep-pack list merge-ort: fix two leaks when handling directory rename modifications match-trees: fix leaking prefixes in `shift_tree()` builtin/fmt-merge-msg: fix leaking buffers builtin/grep: fix leaking object context builtin/pack-objects: plug leaking list of keep-packs builtin/repack: fix leaking line buffer when packing promisors negotiator/skipping: fix leaking commit entries shallow: fix leaking members of `struct shallow_info` shallow: free grafts when unregistering them object: clear grafts when clearing parsed object pool gpg-interface: fix misdesigned signing key interfaces send-pack: fix leaking push cert nonce remote: fix leak in reachability check of a remote-tracking ref remote: fix leaking tracking refs builtin/submodule--helper: fix leaking refs on push-check submodule: fix leaking fetch task data upload-pack: fix leaking child process data on reachability checks builtin/push: fix leaking refspec query result send-pack: fix leaking common object IDs ...
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index 539e5ceae3..390a03c264 100644
--- a/remote.c
+++ b/remote.c
@@ -1123,6 +1123,7 @@ void free_one_ref(struct ref *ref)
return;
free_one_ref(ref->peer_ref);
free(ref->remote_status);
+ free(ref->tracking_ref);
free(ref->symref);
free(ref);
}
@@ -2620,8 +2621,10 @@ static int remote_tracking(struct remote *remote, const char *refname,
dst = apply_refspecs(&remote->fetch, refname);
if (!dst)
return -1; /* no tracking ref for refname at remote */
- if (refs_read_ref(get_main_ref_store(the_repository), dst, oid))
+ if (refs_read_ref(get_main_ref_store(the_repository), dst, oid)) {
+ free(dst);
return -1; /* we know what the tracking ref is but we cannot read it */
+ }
*dst_refname = dst;
return 0;
@@ -2771,6 +2774,7 @@ static void check_if_includes_upstream(struct ref *remote)
if (is_reachable_in_reflog(local->name, remote) <= 0)
remote->unreachable = 1;
+ free_one_ref(local);
}
static void apply_cas(struct push_cas_option *cas,