Skip to content

Commit cf8072e

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 75f4acc commit cf8072e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

remote-curl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static struct ref *parse_info_refs(struct discovery *heads)
347347
ref->next = refs;
348348
refs = ref;
349349
} else {
350-
free(ref);
350+
free_one_ref(ref);
351351
}
352352

353353
return refs;

0 commit comments

Comments
 (0)