]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix a leak in an error path when duplicating an OSSL_DECODER_CTX.
authorMatt Caswell <matt@openssl.org>
Tue, 15 Aug 2023 14:05:38 +0000 (15:05 +0100)
committerHugo Landau <hlandau@openssl.org>
Thu, 17 Aug 2023 07:06:43 +0000 (08:06 +0100)
Make sure we free process_data_dest if it is not actually used.

Found by the reproducible error patch in #21668

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21741)

crypto/encode_decode/decoder_pkey.c

index 65dc1326e28bec213c8bfb58381aa73743e0b219..c38c7e3dffa4b1e0ab9eb2a22c8f1acf4922aab5 100644 (file)
@@ -579,6 +579,7 @@ ossl_decoder_ctx_for_pkey_dup(OSSL_DECODER_CTX *src,
     if (process_data_dest != NULL) {
         OPENSSL_free(process_data_dest->propq);
         sk_EVP_KEYMGMT_pop_free(process_data_dest->keymgmts, EVP_KEYMGMT_free);
+        OPENSSL_free(process_data_dest);
     }
     OSSL_DECODER_CTX_free(dest);
     return NULL;