Fix a memory leak in an error path
authorMatt Caswell <matt@openssl.org>
Tue, 29 May 2018 15:05:10 +0000 (16:05 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 31 May 2018 09:39:13 +0000 (10:39 +0100)
Found by Coverity

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6373)

apps/s_client.c

index 9122d489364c4ed012749e297534b83d2cea881f..09f534033f0507551d431e30b8a65b6beb4a93ea 100644 (file)
@@ -201,6 +201,7 @@ static int psk_use_session_cb(SSL *s, const EVP_MD *md,
         cipher = SSL_CIPHER_find(s, tls13_aes128gcmsha256_id);
         if (cipher == NULL) {
             BIO_printf(bio_err, "Error finding suitable ciphersuite\n");
         cipher = SSL_CIPHER_find(s, tls13_aes128gcmsha256_id);
         if (cipher == NULL) {
             BIO_printf(bio_err, "Error finding suitable ciphersuite\n");
+            OPENSSL_free(key);
             return 0;
         }
 
             return 0;
         }