summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_sess.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2001-08-12 16:52:00 +0000
committerGeoff Thorpe <geoff@openssl.org>2001-08-12 16:52:00 +0000
commitb7727ee616a3351a001497dda077ec63330861db (patch)
treecfb5ada448b2a405e2b7b3967a48ba61f690d9aa /ssl/ssl_sess.c
parentf0446ca8d746ff138a892588e33597411f59f5fa (diff)
The indexes returned by ***_get_ex_new_index() functions are used when
setting stack (actually, array) values in ex_data. So only increment the global counters if the underlying CRYPTO_get_ex_new_index() call succeeds. This change doesn't make "ex_data" right (see the comment at the head of ex_data.c to know why), but at least makes the source code marginally less frustrating.
Diffstat (limited to 'ssl/ssl_sess.c')
-rw-r--r--ssl/ssl_sess.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index 1b87de9d21..5821792b76 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -91,10 +91,10 @@ SSL_SESSION *SSL_get1_session(SSL *ssl)
int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
- ssl_session_num++;
- return(CRYPTO_get_ex_new_index(ssl_session_num-1,
- &ssl_session_meth,
- argl,argp,new_func,dup_func,free_func));
+ if(CRYPTO_get_ex_new_index(ssl_session_num, &ssl_session_meth, argl,
+ argp, new_func, dup_func, free_func) < 0)
+ return -1;
+ return (ssl_session_num++);
}
int SSL_SESSION_set_ex_data(SSL_SESSION *s, int idx, void *arg)