properly free the resource from CRYPTO_malloc
authorxkernel <xkernel.wang@foxmail.com>
Tue, 4 Jan 2022 13:18:02 +0000 (21:18 +0800)
committerTomas Mraz <tomas@openssl.org>
Thu, 6 Jan 2022 11:01:10 +0000 (12:01 +0100)
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17412)

ssl/statem/statem_clnt.c

index 10e778d681b6abf78d9020fc339d37ab8e4c5bb7..3e94d9e1851bb90006555093d754bae2567ea57f 100644 (file)
@@ -3187,7 +3187,7 @@ static int tls_construct_cke_gost18(SSL *s, WPACKET *pkt)
     if (peer_cert == NULL) {
         SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE,
                  SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER);
-        return 0;
+        goto err;
     }
 
     pkey_ctx = EVP_PKEY_CTX_new_from_pkey(s->ctx->libctx,
@@ -3195,7 +3195,7 @@ static int tls_construct_cke_gost18(SSL *s, WPACKET *pkt)
                                           s->ctx->propq);
     if (pkey_ctx == NULL) {
         SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_MALLOC_FAILURE);
-        return 0;
+        goto err;
     }
 
     if (EVP_PKEY_encrypt_init(pkey_ctx) <= 0) {