summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2009-11-18 02:42:21 +0100
committerJunio C Hamano <gitster@pobox.com>2009-11-17 21:39:58 -0800
commitf2a37151d4624906e34a9bcafb2ad79d0e8cb7ec (patch)
tree9e0d14a46079f8a1ef9d94c73144a4d14e6f2e3b /transport-helper.c
parentcd0f8e6d63d3e2744d7d3b2329238be7d064a8ea (diff)
downloadgit-f2a37151d4624906e34a9bcafb2ad79d0e8cb7ec.tar.gz
Fix memory leak in helper method for disconnect
Since some cases may need to disconnect from the helper and reconnect, wrap the function that just disconnects in a function that also frees transport->data. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/transport-helper.c b/transport-helper.c
index f57e84c676..e24fcbb17d 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -67,6 +67,13 @@ static int disconnect_helper(struct transport *transport)
return 0;
}
+static int release_helper(struct transport *transport)
+{
+ disconnect_helper(transport);
+ free(transport->data);
+ return 0;
+}
+
static int fetch_with_fetch(struct transport *transport,
int nr_heads, const struct ref **to_fetch)
{
@@ -163,6 +170,6 @@ int transport_helper_init(struct transport *transport, const char *name)
transport->data = data;
transport->get_refs_list = get_refs_list;
transport->fetch = fetch;
- transport->disconnect = disconnect_helper;
+ transport->disconnect = release_helper;
return 0;
}