1*2175Sjp161948=pod 2*2175Sjp161948 3*2175Sjp161948=head1 NAME 4*2175Sjp161948 5*2175Sjp161948SSL_SESSION_free - free an allocated SSL_SESSION structure 6*2175Sjp161948 7*2175Sjp161948=head1 SYNOPSIS 8*2175Sjp161948 9*2175Sjp161948 #include <openssl/ssl.h> 10*2175Sjp161948 11*2175Sjp161948 void SSL_SESSION_free(SSL_SESSION *session); 12*2175Sjp161948 13*2175Sjp161948=head1 DESCRIPTION 14*2175Sjp161948 15*2175Sjp161948SSL_SESSION_free() decrements the reference count of B<session> and removes 16*2175Sjp161948the B<SSL_SESSION> structure pointed to by B<session> and frees up the allocated 17*2175Sjp161948memory, if the the reference count has reached 0. 18*2175Sjp161948 19*2175Sjp161948=head1 NOTES 20*2175Sjp161948 21*2175Sjp161948SSL_SESSION objects are allocated, when a TLS/SSL handshake operation 22*2175Sjp161948is successfully completed. Depending on the settings, see 23*2175Sjp161948L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, 24*2175Sjp161948the SSL_SESSION objects are internally referenced by the SSL_CTX and 25*2175Sjp161948linked into its session cache. SSL objects may be using the SSL_SESSION object; 26*2175Sjp161948as a session may be reused, several SSL objects may be using one SSL_SESSION 27*2175Sjp161948object at the same time. It is therefore crucial to keep the reference 28*2175Sjp161948count (usage information) correct and not delete a SSL_SESSION object 29*2175Sjp161948that is still used, as this may lead to program failures due to 30*2175Sjp161948dangling pointers. These failures may also appear delayed, e.g. 31*2175Sjp161948when an SSL_SESSION object was completely freed as the reference count 32*2175Sjp161948incorrectly became 0, but it is still referenced in the internal 33*2175Sjp161948session cache and the cache list is processed during a 34*2175Sjp161948L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> operation. 35*2175Sjp161948 36*2175Sjp161948SSL_SESSION_free() must only be called for SSL_SESSION objects, for 37*2175Sjp161948which the reference count was explicitly incremented (e.g. 38*2175Sjp161948by calling SSL_get1_session(), see L<SSL_get_session(3)|SSL_get_session(3)>) 39*2175Sjp161948or when the SSL_SESSION object was generated outside a TLS handshake 40*2175Sjp161948operation, e.g. by using L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>. 41*2175Sjp161948It must not be called on other SSL_SESSION objects, as this would cause 42*2175Sjp161948incorrect reference counts and therefore program failures. 43*2175Sjp161948 44*2175Sjp161948=head1 RETURN VALUES 45*2175Sjp161948 46*2175Sjp161948SSL_SESSION_free() does not provide diagnostic information. 47*2175Sjp161948 48*2175Sjp161948=head1 SEE ALSO 49*2175Sjp161948 50*2175Sjp161948L<ssl(3)|ssl(3)>, L<SSL_get_session(3)|SSL_get_session(3)>, 51*2175Sjp161948L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, 52*2175Sjp161948L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, 53*2175Sjp161948 L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)> 54*2175Sjp161948 55*2175Sjp161948=cut 56