mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
fetch_refs_via_pack: free extra copy of refs
When fetch_refs_via_pack calls fetch_pack(), we pass a list of refs to fetch, and the function returns either a copy of that list, with the fetched items filled in, or NULL. We check the return value to see whether the fetch was successful, but do not otherwise look at the copy, and simply leak it at the end of the function. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
c3c17bf107
commit
626df76e3d
|
@ -519,7 +519,7 @@ static int fetch_refs_via_pack(struct transport *transport,
|
|||
int nr_heads, struct ref **to_fetch)
|
||||
{
|
||||
struct git_transport_data *data = transport->data;
|
||||
const struct ref *refs;
|
||||
struct ref *refs;
|
||||
char *dest = xstrdup(transport->url);
|
||||
struct fetch_pack_args args;
|
||||
struct ref *refs_tmp = NULL;
|
||||
|
@ -552,15 +552,17 @@ static int fetch_refs_via_pack(struct transport *transport,
|
|||
&transport->pack_lockfile);
|
||||
close(data->fd[0]);
|
||||
close(data->fd[1]);
|
||||
if (finish_connect(data->conn))
|
||||
if (finish_connect(data->conn)) {
|
||||
free_refs(refs);
|
||||
refs = NULL;
|
||||
}
|
||||
data->conn = NULL;
|
||||
data->got_remote_heads = 0;
|
||||
data->options.self_contained_and_connected =
|
||||
args.self_contained_and_connected;
|
||||
|
||||
free_refs(refs_tmp);
|
||||
|
||||
free_refs(refs);
|
||||
free(dest);
|
||||
return (refs ? 0 : -1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue