]> git.ipfire.org Git - thirdparty/git.git/commit
remote-curl: free HEAD ref with free_one_ref()
authorJeff King <peff@peff.net>
Tue, 24 Sep 2024 22:03:10 +0000 (18:03 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Sep 2024 17:24:56 +0000 (10:24 -0700)
commitcf8072ed7af61b80e93a54292b8ea92c423c0b66
tree15793f7b43f1e86c1bfd2b4926745c10db308a1a
parent75f4acc98125a9e9f5b3051c0dc6690839830e25
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>
remote-curl.c