Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix a leak in the local transport code. #1675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/transports/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ static void local_cancel(git_transport *transport)
static int local_close(git_transport *transport)
{
transport_local *t = (transport_local *)transport;
size_t i;
git_remote_head *head;

t->connected = 0;

Expand All @@ -584,25 +586,23 @@ static int local_close(git_transport *transport)
t->url = NULL;
}

git_vector_foreach(&t->refs, i, head) {
git__free(head->name);
git__free(head);
}

git_vector_free(&t->refs);

return 0;
}

static void local_free(git_transport *transport)
{
transport_local *t = (transport_local *)transport;
size_t i;
git_remote_head *head;

/* Close the transport, if it's still open. */
local_close(transport);

git_vector_foreach(&t->refs, i, head) {
git__free(head->name);
git__free(head);
}

git_vector_free(&t->refs);

/* Free the transport */
git__free(t);
}
Expand Down