From: Dr. Stephen Henson Date: Wed, 14 Sep 2016 22:54:12 +0000 (+0100) Subject: Fix memory leak on error. X-Git-Tag: OpenSSL_1_0_2i~26 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ea060e026dd29ea0eaf66ad8686f966c8c81eb7f;p=oweals%2Fopenssl.git Fix memory leak on error. Thanks to Shi Lei (Gear Team, Qihoo 360 Inc.) for reporting this bug. Reviewed-by: Rich Salz --- diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c index 35cc27c5e9..499f0e85ad 100644 --- a/ssl/ssl_asn1.c +++ b/ssl/ssl_asn1.c @@ -527,6 +527,9 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, if (os.length > SSL_MAX_SID_CTX_LENGTH) { c.error = SSL_R_BAD_LENGTH; c.line = __LINE__; + OPENSSL_free(os.data); + os.data = NULL; + os.length = 0; goto err; } else { ret->sid_ctx_length = os.length;