summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-11-12 11:24:19 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-11-12 11:24:19 +0100
commitb3338076d830cfadf4dc25632baae740e4567754 (patch)
treea204052c84169a0640766f23af61158b9092287c /src
parentc165eab0f2405f7359329c251056138363869ccc (diff)
downloadweechat-b3338076d830cfadf4dc25632baae740e4567754.zip
Fix crash when calling "weechat-curses --help"
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-network.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index 971634458..0e2059b74 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -47,6 +47,7 @@
#ifdef HAVE_GNUTLS
+int network_init_ok = 0;
gnutls_certificate_credentials gnutls_xcred; /* GnuTLS client credentials */
const int gnutls_cert_type_prio[] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };
#if LIBGNUTLS_VERSION_NUMBER >= 0x010700
@@ -78,6 +79,7 @@ network_init ()
gnutls_certificate_set_x509_trust_file (gnutls_xcred, CApath2, GNUTLS_X509_FMT_PEM);
gnutls_certificate_client_set_retrieve_function (gnutls_xcred,
&hook_connect_gnutls_set_certificates);
+ network_init_ok = 1;
#endif
}
@@ -89,8 +91,11 @@ void
network_end ()
{
#ifdef HAVE_GNUTLS
- gnutls_certificate_free_credentials (gnutls_xcred);
- gnutls_global_deinit();
+ if (network_init_ok)
+ {
+ gnutls_certificate_free_credentials (gnutls_xcred);
+ gnutls_global_deinit();
+ }
#endif
}