end:
if (use_supported && sk)
sk_SSL_CIPHER_free(sk);
- if (ctx != NULL)
- SSL_CTX_free(ctx);
- if (ssl != NULL)
- SSL_free(ssl);
+ SSL_CTX_free(ctx);
+ SSL_free(ssl);
BIO_free_all(STDout);
apps_shutdown();
OPENSSL_EXIT(ret);
BIO_printf(bio_err, "Error querying OCSP responder\n");
end:
BIO_free_all(cbio);
- if (ctx)
- SSL_CTX_free(ctx);
+ SSL_CTX_free(ctx);
return resp;
}
if (next_proto.data)
OPENSSL_free(next_proto.data);
#endif
- if (ctx != NULL)
- SSL_CTX_free(ctx);
+ SSL_CTX_free(ctx);
if (cert)
X509_free(cert);
if (crls)
ssl_excert_free(exc);
if (ssl_args)
sk_OPENSSL_STRING_free(ssl_args);
- if (cctx)
- SSL_CONF_CTX_free(cctx);
+ SSL_CONF_CTX_free(cctx);
#ifndef OPENSSL_NO_JPAKE
if (jpake_secret && psk_key)
OPENSSL_free(psk_key);
print_stats(bio_s_out, ctx);
ret = 0;
end:
- if (ctx != NULL)
- SSL_CTX_free(ctx);
+ SSL_CTX_free(ctx);
if (s_cert)
X509_free(s_cert);
if (crls)
OPENSSL_free(tlscstatp.port);
if (tlscstatp.path)
OPENSSL_free(tlscstatp.path);
- if (ctx2 != NULL)
- SSL_CTX_free(ctx2);
+ SSL_CTX_free(ctx2);
if (s_cert2)
X509_free(s_cert2);
EVP_PKEY_free(s_key2);
ssl_excert_free(exc);
if (ssl_args)
sk_OPENSSL_STRING_free(ssl_args);
- if (cctx)
- SSL_CONF_CTX_free(cctx);
+ SSL_CONF_CTX_free(cctx);
#ifndef OPENSSL_NO_JPAKE
if (jpake_secret && psk_key)
OPENSSL_free(psk_key);
ret = 0;
end:
- if (scon != NULL)
- SSL_free(scon);
+ SSL_free(scon);
- if (tm_ctx != NULL) {
- SSL_CTX_free(tm_ctx);
- tm_ctx = NULL;
- }
+ SSL_CTX_free(tm_ctx);
+ tm_ctx = NULL;
apps_shutdown();
OPENSSL_EXIT(ret);
}
ERR_print_errors_fp(stderr);
}
BIO_free_all(out);
- if (ssl_ctx != NULL)
- SSL_CTX_free(ssl_ctx);
+ SSL_CTX_free(ssl_ctx);
exit(!ret);
return (ret);
}
err:
tls_openssl_errors(err_pref_1, err_pref_2, NULL, apparg);
err_return:
- if (ret != NULL)
- SSL_CTX_free(ret);
+ SSL_CTX_free(ret);
return NULL;
}
structure for use with the SSL_CONF functions.
The function SSL_CONF_CTX_free() frees up the context B<cctx>.
+If B<cctx> is NULL nothing is done.
=head1 RETURN VALUES
applicable: the session cache, the list of ciphers, the list of Client CAs,
the certificates and keys.
+If B<ctx> is NULL nothing is done.
+
=head1 WARNINGS
If a session-remove callback is set (SSL_CTX_sess_set_remove_cb()), this
SSL_SESSION_free() decrements the reference count of B<session> and removes
the B<SSL_SESSION> structure pointed to by B<session> and frees up the allocated
memory, if the reference count has reached 0.
+If B<session> is NULL nothing is done.
=head1 NOTES
SSL_free() decrements the reference count of B<ssl>, and removes the SSL
structure pointed to by B<ssl> and frees up the allocated memory if the
reference count has reached 0.
+If B<ssl> is NULL nothing is done.
=head1 NOTES
if (bs->ssl != NULL)
SSL_shutdown(bs->ssl);
if (a->shutdown) {
- if (a->init && (bs->ssl != NULL))
+ if (a->init)
SSL_free(bs->ssl);
a->init = 0;
a->flags = 0;
break;
case BIO_CTRL_DUP:
dbio = (BIO *)ptr;
- if (((BIO_SSL *)dbio->ptr)->ssl != NULL)
- SSL_free(((BIO_SSL *)dbio->ptr)->ssl);
+ SSL_free(((BIO_SSL *)dbio->ptr)->ssl);
((BIO_SSL *)dbio->ptr)->ssl = SSL_dup(ssl);
((BIO_SSL *)dbio->ptr)->renegotiate_count =
((BIO_SSL *)b->ptr)->renegotiate_count;
if (sc == NULL)
goto err;
- if (s->session->sess_cert)
- ssl_sess_cert_free(s->session->sess_cert);
+ ssl_sess_cert_free(s->session->sess_cert);
s->session->sess_cert = sc;
sc->cert_chain = sk;
return (s);
err:
- if (s != NULL)
- SSL_free(s);
+ SSL_free(s);
SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
}
void ssl_free_wbio_buffer(SSL *s)
{
+ /* callers ensure s is never null */
if (s->bbio == NULL)
return;
else
ss->timeout = s->session_ctx->session_timeout;
- if (s->session != NULL) {
- SSL_SESSION_free(s->session);
- s->session = NULL;
- }
+ SSL_SESSION_free(s->session);
+ s->session = NULL;
if (session) {
if (s->version == SSL3_VERSION) {
s->session_ctx->stats.sess_hit++;
- if (s->session != NULL)
- SSL_SESSION_free(s->session);
+ SSL_SESSION_free(s->session);
s->session = ret;
s->verify_result = s->session->verify_result;
return 1;
SSL_free(c_ssl);
end:
- if (s_ctx != NULL)
- SSL_CTX_free(s_ctx);
- if (c_ctx != NULL)
- SSL_CTX_free(c_ctx);
-
- if (s_cctx)
- SSL_CONF_CTX_free(s_cctx);
- if (c_cctx)
- SSL_CONF_CTX_free(c_cctx);
+ SSL_CTX_free(s_ctx);
+ SSL_CTX_free(c_ctx);
+
+ SSL_CONF_CTX_free(s_cctx);
+ SSL_CONF_CTX_free(c_cctx);
sk_OPENSSL_STRING_free(conf_args);
BIO_free(bio_stdout);