SSL_SESSION_free.pod revision 89837
168651Skris=pod 268651Skris 368651Skris=head1 NAME 468651Skris 568651SkrisSSL_SESSION_free - free an allocated SSL_SESSION structure 668651Skris 768651Skris=head1 SYNOPSIS 868651Skris 968651Skris #include <openssl/ssl.h> 1068651Skris 1168651Skris void SSL_SESSION_free(SSL_SESSION *session); 1268651Skris 1368651Skris=head1 DESCRIPTION 1468651Skris 1568651SkrisSSL_SESSION_free() decrements the reference count of B<session> and removes 1668651Skristhe B<SSL_SESSION> structure pointed to by B<session> and frees up the allocated 1768651Skrismemory, if the the reference count has reached 0. 1868651Skris 1989837Skris=head1 NOTES 2089837Skris 2189837SkrisSSL_SESSION objects are allocated, when a TLS/SSL handshake operation 2289837Skrisis successfully completed. Depending on the settings, see 2389837SkrisL<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, 2489837Skristhe SSL_SESSION objects are internally referenced by the SSL_CTX and 2589837Skrislinked into its session cache. SSL objects may be using the SSL_SESSION object; 2689837Skrisas a session may be reused, several SSL objects may be using one SSL_SESSION 2789837Skrisobject at the same time. It is therefore crucial to keep the reference 2889837Skriscount (usage information) correct and not delete a SSL_SESSION object 2989837Skristhat is still used, as this may lead to program failures due to 3089837Skrisdangling pointers. These failures may also appear delayed, e.g. 3189837Skriswhen an SSL_SESSION object was completely freed as the reference count 3289837Skrisincorrectly became 0, but it is still referenced in the internal 3389837Skrissession cache and the cache list is processed during a 3489837SkrisL<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> operation. 3589837Skris 3689837SkrisSSL_SESSION_free() must only be called for SSL_SESSION objects, for 3789837Skriswhich the reference count was explicitly incremented (e.g. 3889837Skrisby calling SSL_get1_session(), see L<SSL_get_session(3)|SSL_get_session(3)>) 3989837Skrisor when the SSL_SESSION object was generated outside a TLS handshake 4089837Skrisoperation, e.g. by using L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>. 4189837SkrisIt must not be called on other SSL_SESSION objects, as this would cause 4289837Skrisincorrect reference counts and therefore program failures. 4389837Skris 4468651Skris=head1 RETURN VALUES 4568651Skris 4668651SkrisSSL_SESSION_free() does not provide diagnostic information. 4768651Skris 4889837Skris=head1 SEE ALSO 4968651Skris 5089837SkrisL<ssl(3)|ssl(3)>, L<SSL_get_session(3)|SSL_get_session(3)>, 5189837SkrisL<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, 5289837SkrisL<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, 5389837Skris L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)> 5489837Skris 5568651Skris=cut 56