Fix a memory leak on an error path
authorMatt Caswell <matt@openssl.org>
Sat, 4 Mar 2017 15:45:40 +0000 (15:45 +0000)
committerMatt Caswell <matt@openssl.org>
Sat, 4 Mar 2017 16:20:13 +0000 (16:20 +0000)
A leak of an SSL_SESSION object can occur when decoding a psk extension on
an error path when using TLSv1.3

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2843)

ssl/statem/extensions_srvr.c

index 83fb71313afe5acb9c47958296eaa025cff8fed7..ab3ad468fb99bf2f9f442d7e23c76ddc234c718d 100644 (file)
@@ -796,6 +796,7 @@ int tls_parse_ctos_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
     s->session = sess;
     return 1;
 err:
+    SSL_SESSION_free(sess);
     return 0;
 }