1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

gnutls: fix memory leak.

This commit is contained in:
Steven Schweda 2011-11-04 22:31:48 +01:00 committed by Giuseppe Scrivano
parent e3820953b2
commit 127036d3ec
2 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,6 @@
2011-11-04 Giuseppe Scrivano <gscrivano@gnu.org> 2011-11-01 Steven Schweda <address@hidden>
* gnutls.c (ssl_init): Ensure GNU TLS is loaded only once.
2011-10-07 Steven Schweda <address@hidden> 2011-10-07 Steven Schweda <address@hidden>

View File

@ -63,6 +63,13 @@ static gnutls_certificate_credentials credentials;
bool bool
ssl_init () ssl_init ()
{ {
/* Becomes true if GnuTLS is initialized. */
static bool ssl_initialized = false;
/* GnuTLS should be initialized only once. */
if (ssl_initialized)
return true;
const char *ca_directory; const char *ca_directory;
DIR *dir; DIR *dir;
@ -104,6 +111,9 @@ ssl_init ()
if (opt.ca_cert) if (opt.ca_cert)
gnutls_certificate_set_x509_trust_file (credentials, opt.ca_cert, gnutls_certificate_set_x509_trust_file (credentials, opt.ca_cert,
GNUTLS_X509_FMT_PEM); GNUTLS_X509_FMT_PEM);
ssl_initialized = true;
return true; return true;
} }