Fix a ssl session leak due to OOM in lh_SSL_SESSION_insert
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Thu, 22 Dec 2016 19:17:29 +0000 (20:17 +0100)
committerRichard Levitte <levitte@openssl.org>
Tue, 24 Jan 2017 14:05:12 +0000 (15:05 +0100)
commit38088ce9934a90d4aea486edbff864f3935342e6
treef64492188cd38ec53fb40888227981255ae93bf8
parentc2114afc1622ff0113974b3696e557ea8bf7ffb4
Fix a ssl session leak due to OOM in lh_SSL_SESSION_insert

- s == NULL can mean c is a new session *or* lh_insert was
  unable to create a hash entry.
- use lh_SSL_SESSION_retrieve to check for this error condition.
- If it happens simply remove the extra reference again.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2138)
ssl/ssl_sess.c