Add ssl_cleanup to free memory

* src/ssl.h: Add declaration for ssl_cleanup.
* src/openssl.c: Add ssl_cleanup stub.
* src/gnutls.c: Implement ssl_cleanup.
This commit is contained in:
Tim Rühsen 2020-02-27 14:29:22 +01:00
parent 7146b9dc77
commit b209ca91fb
3 changed files with 15 additions and 0 deletions

View File

@ -226,6 +226,15 @@ cert to be of the same type.\n"));
return true; return true;
} }
void
ssl_cleanup (void)
{
if (credentials)
gnutls_certificate_free_credentials(credentials);
gnutls_global_deinit();
}
struct wgnutls_transport_context struct wgnutls_transport_context
{ {
gnutls_session_t session; /* GnuTLS session handle */ gnutls_session_t session; /* GnuTLS session handle */

View File

@ -415,6 +415,11 @@ ssl_init (void)
return false; return false;
} }
void
ssl_cleanup (void)
{
}
struct openssl_transport_context struct openssl_transport_context
{ {
SSL *conn; /* SSL connection handle */ SSL *conn; /* SSL connection handle */

View File

@ -33,6 +33,7 @@ as that of the covered work. */
#define GEN_SSLFUNC_H #define GEN_SSLFUNC_H
bool ssl_init (void); bool ssl_init (void);
void ssl_cleanup (void);
bool ssl_connect_wget (int, const char *, int *); bool ssl_connect_wget (int, const char *, int *);
bool ssl_check_certificate (int, const char *); bool ssl_check_certificate (int, const char *);