From 0ceb477ff62e952488efd9759576a06895c83b3b Mon Sep 17 00:00:00 2001 From: Will Cosgrove Date: Wed, 31 Jul 2019 13:29:29 -0700 Subject: [PATCH] global.c : fixed call to libssh2_crypto_exit #394 (#396) * global.c : fixed call to libssh2_crypto_exit #394 File: global.c Notes: Don't call `libssh2_crypto_exit()` until `_libssh2_initialized` count is down to zero. Credit: seba30 --- src/global.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/global.c b/src/global.c index f88eb33d..68289845 100644 --- a/src/global.c +++ b/src/global.c @@ -62,7 +62,8 @@ libssh2_exit(void) _libssh2_initialized--; - if(!(_libssh2_init_flags & LIBSSH2_INIT_NO_CRYPTO)) { + if(_libssh2_initialized == 0 && + !(_libssh2_init_flags & LIBSSH2_INIT_NO_CRYPTO)) { libssh2_crypto_exit(); }