Hi Brian, On September 8, 2003 11:36 am, Brian Hatch wrote: > Is there a function that I can use to increment the refernce > count of an SSL_SESSION* ? Obviously I can just > "ssl_session->reference += 1" -- the program is single threaded, > so that's not even a problem. I'd like to avoid using an > additional SSL_get1_session call because it's not clean for the > purpose in this case. (One section of code has a SSL_SESISON* > and another needs to get a copy without having access to the > underlying SSL*, but the code come from two products, so I wouldn't > want to introduce a memory leak in the one that actually does the > SSL stuff.)
Your best bet is to increment the reference count directly, there's no existing SSL_SESSION API function for doing this. If you want to make your code thread-safe in case it gets reused later under threading circumstances, then wrap it with the appropriate locking; CRYPTO_w_lock(CRYPTO_LOCK_SSL_SESSION); sess->references++; CRYPTO_w_unlock(CRYPTO_LOCK_SSL_SESSION); Oh, and thanks for making me look at this - I've just realised the locking in ssl/ssl_sess.c is wrong ... commiting a fix shortly. :-) Cheers, Geoff -- Geoff Thorpe [EMAIL PROTECTED] http://www.geoffthorpe.net/ ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]