Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/global.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

git_mutex git__mwindow_mutex;

#define MAX_SHUTDOWN_CB 8
#define MAX_SHUTDOWN_CB 9

static git_global_shutdown_fn git__shutdown_callbacks[MAX_SHUTDOWN_CB];
static git_atomic git__n_shutdown_callbacks;
Expand Down
14 changes: 13 additions & 1 deletion src/transports/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <libssh2.h>
#endif

#include "global.h"
#include "git2.h"
#include "buffer.h"
#include "netops.h"
Expand Down Expand Up @@ -893,11 +894,22 @@ int git_transport_ssh_with_paths(git_transport **out, git_remote *owner, void *p
#endif
}

#ifdef GIT_SSH
static void shutdown_ssh(void)
{
libssh2_exit();
}
#endif

int git_transport_ssh_global_init(void)
{
#ifdef GIT_SSH
if (libssh2_init(0) < 0) {
giterr_set(GITERR_SSH, "unable to initialize libssh2");
return -1;
}

libssh2_init(0);
git__on_shutdown(shutdown_ssh);
return 0;

#else
Expand Down