1SSL_SESSION_free(3)                 OpenSSL                SSL_SESSION_free(3)
2
3
4

NAME

6       SSL_SESSION_free - free an allocated SSL_SESSION structure
7

SYNOPSIS

9        #include <openssl/ssl.h>
10
11        void SSL_SESSION_free(SSL_SESSION *session);
12

DESCRIPTION

14       SSL_SESSION_free() decrements the reference count of session and
15       removes the SSL_SESSION structure pointed to by session and frees up
16       the allocated memory, if the reference count has reached 0.
17

NOTES

19       SSL_SESSION objects are allocated, when a TLS/SSL handshake operation
20       is successfully completed. Depending on the settings, see
21       SSL_CTX_set_session_cache_mode(3), the SSL_SESSION objects are
22       internally referenced by the SSL_CTX and linked into its session cache.
23       SSL objects may be using the SSL_SESSION object; as a session may be
24       reused, several SSL objects may be using one SSL_SESSION object at the
25       same time. It is therefore crucial to keep the reference count (usage
26       information) correct and not delete a SSL_SESSION object that is still
27       used, as this may lead to program failures due to dangling pointers.
28       These failures may also appear delayed, e.g.  when an SSL_SESSION
29       object was completely freed as the reference count incorrectly became
30       0, but it is still referenced in the internal session cache and the
31       cache list is processed during a SSL_CTX_flush_sessions(3) operation.
32
33       SSL_SESSION_free() must only be called for SSL_SESSION objects, for
34       which the reference count was explicitly incremented (e.g.  by calling
35       SSL_get1_session(), see SSL_get_session(3)) or when the SSL_SESSION
36       object was generated outside a TLS handshake operation, e.g. by using
37       d2i_SSL_SESSION(3).  It must not be called on other SSL_SESSION
38       objects, as this would cause incorrect reference counts and therefore
39       program failures.
40

RETURN VALUES

42       SSL_SESSION_free() does not provide diagnostic information.
43

SEE ALSO

45       ssl(3), SSL_get_session(3), SSL_CTX_set_session_cache_mode(3),
46       SSL_CTX_flush_sessions(3),
47        d2i_SSL_SESSION(3)
48
49
50
511.0.2k                            2017-01-26               SSL_SESSION_free(3)
Impressum