summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-28 09:33:08 -0700
committerJunio C Hamano <gitster@pobox.com>2015-03-28 09:33:08 -0700
commit591a1daa7cdfd40ce76d0afcca05a7a648e73f3d (patch)
tree3a7233ef14b8c784526b2b2c497ae1ede1ac1ae7 /transport.c
parent07e3f27f48372664f935d250139f52a7a1364e9e (diff)
parent32d0462f8da9cc4e26ca1e785098e2ae1bee4d02 (diff)
downloadgit-591a1daa7cdfd40ce76d0afcca05a7a648e73f3d.tar.gz
Merge branch 'jk/fetch-pack' into maint
"git fetch" that fetches a commit using the allow-tip-sha1-in-want extension could have failed to fetch all the requested refs. * jk/fetch-pack: fetch-pack: remove dead assignment to ref->new_sha1 fetch_refs_via_pack: free extra copy of refs filter_ref: make a copy of extra "sought" entries filter_ref: avoid overwriting ref->old_sha1 with garbage
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/transport.c b/transport.c
index 862f63f4e1..88bde1d85e 100644
--- a/transport.c
+++ b/transport.c
@@ -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);
}