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

Skip to content

Commit 5b4a708

Browse files
committed
Merge pull request libgit2#1675 from arthurschreiber/fix-leak-in-local-transport
Fix a leak in the local transport code.
2 parents 1221225 + 8c510b8 commit 5b4a708

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/transports/local.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ static void local_cancel(git_transport *transport)
571571
static int local_close(git_transport *transport)
572572
{
573573
transport_local *t = (transport_local *)transport;
574+
size_t i;
575+
git_remote_head *head;
574576

575577
t->connected = 0;
576578

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

589+
git_vector_foreach(&t->refs, i, head) {
590+
git__free(head->name);
591+
git__free(head);
592+
}
593+
594+
git_vector_free(&t->refs);
595+
587596
return 0;
588597
}
589598

590599
static void local_free(git_transport *transport)
591600
{
592601
transport_local *t = (transport_local *)transport;
593-
size_t i;
594-
git_remote_head *head;
595602

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

599-
git_vector_foreach(&t->refs, i, head) {
600-
git__free(head->name);
601-
git__free(head);
602-
}
603-
604-
git_vector_free(&t->refs);
605-
606606
/* Free the transport */
607607
git__free(t);
608608
}

0 commit comments

Comments
 (0)