diff options
author | Jeff King <peff@peff.net> | 2015-03-19 16:38:35 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-19 14:11:35 -0700 |
commit | 626df76e3df3a0d8ecee07098706547648e6c96f (patch) | |
tree | 23bc39b0faaa3cddaa308f9c9c5f74236a9ebf7a | |
parent | filter_ref: make a copy of extra "sought" entries (diff) | |
download | tgif-626df76e3df3a0d8ecee07098706547648e6c96f.tar.xz |
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>
-rw-r--r-- | transport.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/transport.c b/transport.c index 70d38e4c4b..2e11f8ea82 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); } |