vendor/libgit2/src/libgit2/transports/ssh.c in rugged-1.6.5 vs vendor/libgit2/src/libgit2/transports/ssh.c in rugged-1.7.1

- old
+ new

@@ -11,11 +11,10 @@ #include <libssh2.h> #endif #include "runtime.h" #include "net.h" -#include "netops.h" #include "smart.h" #include "streams/socket.h" #include "sysdir.h" #include "git2/credential.h" @@ -876,14 +875,15 @@ s->channel = channel; t->current_stream = s; done: + if (known_hosts) + libssh2_knownhost_free(known_hosts); + if (error < 0) { ssh_stream_free(*stream); - if (known_hosts) - libssh2_knownhost_free(known_hosts); if (session) libssh2_session_free(session); } if (cred)