xref: /freebsd/crypto/openssl/doc/man3/SSL_free.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimSSL_free - free an allocated SSL structure
6e71b7053SJung-uk Kim
7e71b7053SJung-uk Kim=head1 SYNOPSIS
8e71b7053SJung-uk Kim
9e71b7053SJung-uk Kim #include <openssl/ssl.h>
10e71b7053SJung-uk Kim
11e71b7053SJung-uk Kim void SSL_free(SSL *ssl);
12e71b7053SJung-uk Kim
13e71b7053SJung-uk Kim=head1 DESCRIPTION
14e71b7053SJung-uk Kim
15e71b7053SJung-uk KimSSL_free() decrements the reference count of B<ssl>, and removes the SSL
16e71b7053SJung-uk Kimstructure pointed to by B<ssl> and frees up the allocated memory if the
17e71b7053SJung-uk Kimreference count has reached 0.
18e71b7053SJung-uk KimIf B<ssl> is NULL nothing is done.
19e71b7053SJung-uk Kim
20e71b7053SJung-uk Kim=head1 NOTES
21e71b7053SJung-uk Kim
22e71b7053SJung-uk KimSSL_free() also calls the free()ing procedures for indirectly affected items, if
23e71b7053SJung-uk Kimapplicable: the buffering BIO, the read and write BIOs,
24e71b7053SJung-uk Kimcipher lists specially created for this B<ssl>, the B<SSL_SESSION>.
25e71b7053SJung-uk KimDo not explicitly free these indirectly freed up items before or after
26e71b7053SJung-uk Kimcalling SSL_free(), as trying to free things twice may lead to program
27e71b7053SJung-uk Kimfailure.
28e71b7053SJung-uk Kim
29e71b7053SJung-uk KimThe ssl session has reference counts from two users: the SSL object, for
30e71b7053SJung-uk Kimwhich the reference count is removed by SSL_free() and the internal
31e71b7053SJung-uk Kimsession cache. If the session is considered bad, because
32e71b7053SJung-uk KimL<SSL_shutdown(3)> was not called for the connection
33e71b7053SJung-uk Kimand L<SSL_set_shutdown(3)> was not used to set the
34e71b7053SJung-uk KimSSL_SENT_SHUTDOWN state, the session will also be removed
35e71b7053SJung-uk Kimfrom the session cache as required by RFC2246.
36e71b7053SJung-uk Kim
37e71b7053SJung-uk Kim=head1 RETURN VALUES
38e71b7053SJung-uk Kim
39e71b7053SJung-uk KimSSL_free() does not provide diagnostic information.
40e71b7053SJung-uk Kim
41e71b7053SJung-uk KimL<SSL_new(3)>, L<SSL_clear(3)>,
42e71b7053SJung-uk KimL<SSL_shutdown(3)>, L<SSL_set_shutdown(3)>,
43e71b7053SJung-uk KimL<ssl(7)>
44e71b7053SJung-uk Kim
45e71b7053SJung-uk Kim=head1 COPYRIGHT
46e71b7053SJung-uk Kim
47e71b7053SJung-uk KimCopyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
48e71b7053SJung-uk Kim
49*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
50e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
51e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
52e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
53e71b7053SJung-uk Kim
54e71b7053SJung-uk Kim=cut
55