mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
Make sure we clean-up after ourself upon failure.
This commit is contained in:
parent
5146ce9631
commit
53d772e48b
@ -787,18 +787,20 @@ int irssi_ssl_handshake(GIOChannel *handle)
|
|||||||
|
|
||||||
if (cert == NULL) {
|
if (cert == NULL) {
|
||||||
g_warning("TLS server supplied no certificate");
|
g_warning("TLS server supplied no certificate");
|
||||||
return -1;
|
ret = 0;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pubkey == NULL) {
|
if (pubkey == NULL) {
|
||||||
g_warning("TLS server supplied no certificate public key");
|
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)) {
|
if (! X509_digest(cert, EVP_sha256(), cert_fingerprint, &cert_fingerprint_size)) {
|
||||||
g_warning("Unable to generate certificate fingerprint");
|
g_warning("Unable to generate certificate fingerprint");
|
||||||
X509_free(cert);
|
ret = 0;
|
||||||
return -1;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
pubkey_size = i2d_X509_PUBKEY(pubkey, NULL);
|
pubkey_size = i2d_X509_PUBKEY(pubkey, NULL);
|
||||||
@ -847,6 +849,7 @@ int irssi_ssl_handshake(GIOChannel *handle)
|
|||||||
// Emit the TLS rec.
|
// Emit the TLS rec.
|
||||||
signal_emit("tls handshake finished", 2, chan->server, tls);
|
signal_emit("tls handshake finished", 2, chan->server, tls);
|
||||||
|
|
||||||
|
done:
|
||||||
tls_rec_free(tls);
|
tls_rec_free(tls);
|
||||||
X509_free(cert);
|
X509_free(cert);
|
||||||
g_free(pubkey_der);
|
g_free(pubkey_der);
|
||||||
|
Loading…
Reference in New Issue
Block a user