Commit a2888919 by Carlos Martín Nieto

local transport: don't segfault on wrong URL

memset the structure on initialisation and don't try to dereference
the vector with the heads if we didn't find a repository.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
parent ccc9872d
......@@ -201,16 +201,19 @@ static void local_free(git_transport *transport)
unsigned int i;
transport_local *t = (transport_local *) transport;
git_vector *vec = t->refs;
git_remote_head *h;
assert(transport);
for (i = 0; i < vec->length; ++i) {
git_remote_head *h = git_vector_get(vec, i);
if (t->refs != NULL) {
git_vector_foreach (vec, i, h) {
free(h->name);
free(h);
}
git_vector_free(vec);
free(vec);
}
git_repository_free(t->repo);
free(t->parent.url);
free(t);
......@@ -228,6 +231,8 @@ int git_transport_local(git_transport **out)
if (t == NULL)
return GIT_ENOMEM;
memset(t, 0x0, sizeof(transport_local));
t->parent.connect = local_connect;
t->parent.ls = local_ls;
t->parent.send_wants = local_send_wants;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment