This commit removes dead code from cleanup handling part of the
get_create_tls_context().
In particular, currently:
* there is no way 'found_ctx' might equal 'ctx';
* there is no way 'session_cache' might equal a non-NULL value while
cleaning up after a TLS initialisation error.
INSIST(!query->lookup->tls_ca_set || found_store != NULL);
return (found_ctx);
failure:
- if (ctx != NULL && found_ctx != ctx) {
+ if (ctx != NULL) {
isc_tlsctx_free(&ctx);
}
+ /*
+ * The 'found_store' is being managed by the TLS context
+ * cache. Thus, we should keep it as it is, as it will get
+ * destroyed alongside the cache. As there is one store per
+ * multiple TLS contexts, we need to handle store deletion in a
+ * special way.
+ */
if (store != NULL && store != found_store) {
isc_tls_cert_store_free(&store);
}
- if (sess_cache != NULL && sess_cache != found_sess_cache) {
- isc_tlsctx_client_session_cache_detach(&sess_cache);
- }
return (NULL);
}