Skip to content

Commit

Permalink
wintls: move UnloadSecurityLibrary into ssl_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lifenjoiner committed Dec 26, 2023
1 parent 07acb56 commit 965ae05
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ cleanup (void)
host_cleanup ();
log_cleanup ();
netrc_cleanup ();
#if defined HAVE_SSL && !defined HAVE_WINTLS
#if defined HAVE_SSL
ssl_cleanup ();
#endif
connect_cleanup ();
Expand Down
5 changes: 2 additions & 3 deletions src/win-sspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ bool LoadSecurityLibrary(void) {
goto FAIL;
}

atexit(UnloadSecurityLibrary);
return true;

FAIL:
UnloadSecurityLibrary();
return false;
UnloadSecurityLibrary();
return false;
}

void UnloadSecurityLibrary(void) {
Expand Down
4 changes: 4 additions & 0 deletions src/wintls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,10 @@ bool ssl_init(void) {
return true;
}

void ssl_cleanup (void) {
UnloadSecurityLibrary();
}

/* Perform the SSL/TLS handshake and wrap the connection handle reader and writer
connection-oriented sockets (type SOCK_STREAM)
*/
Expand Down

0 comments on commit 965ae05

Please sign in to comment.