Fix memory leak in tls_parse_stoc_key_share
authorKurt Roeckx <kurt@roeckx.be>
Sun, 18 Dec 2016 11:48:49 +0000 (12:48 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Sun, 18 Dec 2016 23:46:43 +0000 (00:46 +0100)
Found by oss-fuzz

Reviewed-by: Richard Levitte <levitte@openssl.org>
GH: #2102

ssl/statem/extensions_clnt.c

index 70d90e7..6d2ed23 100644 (file)
@@ -1027,6 +1027,7 @@ int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, int *al)
                                         PACKET_remaining(&encoded_pt))) {
         *al = SSL_AD_DECODE_ERROR;
         SSLerr(SSL_F_TLS_PARSE_STOC_KEY_SHARE, SSL_R_BAD_ECPOINT);
+        EVP_PKEY_free(skey);
         return 0;
     }