diff options
author | Alexander Færøy <ahf@0x90.dk> | 2016-10-16 15:04:55 +0200 |
---|---|---|
committer | Alexander Færøy <ahf@0x90.dk> | 2016-10-22 22:04:31 +0200 |
commit | 53d772e48b16e34a82bd9b051f02252f900bb8ef (patch) | |
tree | 8e71c0538fa1bc1f31622f941405e4255f551511 /src | |
parent | 5146ce96318bc9a2513d104ea76ab3277a540074 (diff) | |
download | irssi-53d772e48b16e34a82bd9b051f02252f900bb8ef.zip |
Make sure we clean-up after ourself upon failure.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/network-openssl.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index 13db6e25..3be33b2f 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -787,18 +787,20 @@ int irssi_ssl_handshake(GIOChannel *handle) if (cert == NULL) { g_warning("TLS server supplied no certificate"); - return -1; + ret = 0; + goto done; } if (pubkey == NULL) { g_warning("TLS server supplied no certificate public key"); - return -1; + ret = 0; + goto done; } if (! X509_digest(cert, EVP_sha256(), cert_fingerprint, &cert_fingerprint_size)) { g_warning("Unable to generate certificate fingerprint"); - X509_free(cert); - return -1; + ret = 0; + goto done; } pubkey_size = i2d_X509_PUBKEY(pubkey, NULL); @@ -847,6 +849,7 @@ int irssi_ssl_handshake(GIOChannel *handle) // Emit the TLS rec. signal_emit("tls handshake finished", 2, chan->server, tls); +done: tls_rec_free(tls); X509_free(cert); g_free(pubkey_der); |