Skip to content

Commit ec2439b

Browse files
steven9724ethomson
authored andcommitted
ssh: fix known_hosts leak in _git_ssh_setup_conn
1 parent 86a4a26 commit ec2439b

File tree

1 file changed

+3
-2
lines changed
  • src/libgit2/transports

1 file changed

+3
-2
lines changed

src/libgit2/transports/ssh.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,11 +877,12 @@ static int _git_ssh_setup_conn(
877877
t->current_stream = s;
878878

879879
done:
880+
if (known_hosts)
881+
libssh2_knownhost_free(known_hosts);
882+
880883
if (error < 0) {
881884
ssh_stream_free(*stream);
882885

883-
if (known_hosts)
884-
libssh2_knownhost_free(known_hosts);
885886
if (session)
886887
libssh2_session_free(session);
887888
}

0 commit comments

Comments
 (0)