]> git.ipfire.org Git - thirdparty/openssl.git/commit
crypto/evp: fix double free of tmp_keymgmt in sig/kem/asym init master
authorrootvector2 <dxbnaveed.k@gmail.com>
Wed, 27 May 2026 18:14:23 +0000 (23:44 +0530)
committerEugene Syromiatnikov <esyr@openssl.org>
Sun, 31 May 2026 10:55:17 +0000 (12:55 +0200)
commita21f77dbc99c242b73b5b420714a2cd36bee084a
tree50a944e1a903fb98685e16a68e60abb9903e9e1f
parent31d61a1ceb1556d729410d4ae59503f49e58cf22
crypto/evp: fix double free of tmp_keymgmt in sig/kem/asym init

Commit ecb4757b377f "crypto/evp/m_sigver.c: fix potential double free
on error path in do_sigver_init" has fixed double-free of tmp_keymgmt
in do_sigver_init() by setting it to NULL after EVP_KEYMGMT_free() call;
the same issue present in evp_kem_init(), evp_pkey_asym_cipher_init(),
and evp_pkey_signature_init().  Address it similarly, by setting
the pointers to NULL after *_free() calls.

Complements: ecb4757b377f "crypto/evp/m_sigver.c: fix potential double free on error path in do_sigver_init"
Fixes: 839ffdd11cd4 "EVP: Allow a fallback for operations that work with an EVP_PKEY"
CLA: trivial

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sun May 31 11:03:15 2026
(Merged from https://github.com/openssl/openssl/pull/31312)
crypto/evp/asymcipher.c
crypto/evp/kem.c
crypto/evp/signature.c