summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-25 12:54:25 -0700
committerJunio C Hamano <gitster@pobox.com>2015-03-25 12:54:25 -0700
commit2f6ef7138790d80c43024b132b15ad06daacf266 (patch)
tree3f7c9b2099a4c12051c4c94b6b36587b39433dab /transport.c
parent927936d75391a81250543c928fed620a2af98464 (diff)
parent32d0462f8da9cc4e26ca1e785098e2ae1bee4d02 (diff)
downloadgit-2f6ef7138790d80c43024b132b15ad06daacf266.tar.gz
Merge branch 'jk/fetch-pack'
"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 00f39d9f5b..eca9b8c817 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);
}