-.\" $OpenBSD: SSL_SESSION_free.3,v 1.2 2016/12/06 18:53:55 schwarze Exp $
-.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
+.\" $OpenBSD: SSL_SESSION_free.3,v 1.3 2018/02/26 16:02:14 schwarze Exp $
+.\" full merge up to: OpenSSL b31db505 Mar 24 16:01:50 2017 +0000
.\"
-.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
-.\" Copyright (c) 2000, 2001, 2009 The OpenSSL Project. All rights reserved.
+.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>
+.\" and Matt Caswell <matt@openssl.org>.
+.\" Copyright (c) 2000, 2001, 2009, 2017 The OpenSSL Project.
+.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: December 6 2016 $
+.Dd $Mdocdate: February 26 2018 $
.Dt SSL_SESSION_FREE 3
.Os
.Sh NAME
+.Nm SSL_SESSION_up_ref ,
.Nm SSL_SESSION_free
-.Nd free an allocated SSL_SESSION structure
+.Nd SSL_SESSION reference counting
.Sh SYNOPSIS
.In openssl/ssl.h
+.Ft int
+.Fn SSL_SESSION_up_ref "SSL_SESSION *session"
.Ft void
.Fn SSL_SESSION_free "SSL_SESSION *session"
.Sh DESCRIPTION
-.Fn SSL_SESSION_free
-decrements the reference count of
+.Fn SSL_SESSION_up_ref
+increments the reference count of the given
.Fa session
-and removes the
-.Vt SSL_SESSION
-structure pointed to by
+by 1.
+.Pp
+.Fn SSL_SESSION_free
+decrements the reference count of the given
.Fa session
-and frees up the allocated memory, if the reference count has reached 0.
+by 1.
+If the reference count reaches 0, it frees the memory used by the
+.Fa session .
If
.Fa session
is a
.Vt SSL_SESSION
objects, as this would cause incorrect reference counts and therefore program
failures.
+.Sh RETURN VALUES
+.Fn SSL_SESSION_up_ref
+returns 1 on success or 0 on error.
.Sh SEE ALSO
.Xr d2i_SSL_SESSION 3 ,
.Xr SSL_CTX_flush_sessions 3 ,