diff options
| author | Jeff King <peff@peff.net> | 2024-09-24 18:03:10 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-09-25 10:24:56 -0700 |
| commit | cf8072ed7af61b80e93a54292b8ea92c423c0b66 (patch) | |
| tree | 15793f7b43f1e86c1bfd2b4926745c10db308a1a /remote-curl.c | |
| parent | http: stop leaking buffer in http_get_info_packs() (diff) | |
| download | git-cf8072ed7af61b80e93a54292b8ea92c423c0b66.tar.gz git-cf8072ed7af61b80e93a54292b8ea92c423c0b66.zip | |
remote-curl: free HEAD ref with free_one_ref()
After dumb-http downloads the remote info/refs file, it adds an extra
HEAD ref struct to our list by downloading the remote symref and finding
the matching ref within our list. If either of those fails, we throw
away the ref struct. But we do so with free(), when we should use
free_one_ref() to catch any embedded allocations (in particular, if
fetching the remote HEAD succeeded but the branch is unborn, its
ref->symref field will be populated but we'll still throw it all away).
This leak is triggered by t5550 (but we still have a little more work to
mark it leak-free).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
| -rw-r--r-- | remote-curl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/remote-curl.c b/remote-curl.c index 4adcf25ed6..9a71e04301 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -347,7 +347,7 @@ static struct ref *parse_info_refs(struct discovery *heads) ref->next = refs; refs = ref; } else { - free(ref); + free_one_ref(ref); } return refs; |
