]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix potential memory leak in PKCS12_add_key_ex()
authorNiels Dossche <niels.dossche@ugent.be>
Mon, 28 Oct 2024 16:04:03 +0000 (17:04 +0100)
committerTomas Mraz <tomas@openssl.org>
Mon, 6 Jan 2025 20:33:38 +0000 (21:33 +0100)
commit0f4dfff7840950f15f2339609ca180072a4ebe32
treeb90a89a53c54101ba10eaca4be09cfdbd3b0c096
parent9717c9062a5b605dfe375e328462e2ee7d2df926
Fix potential memory leak in PKCS12_add_key_ex()

p8 is allocated using EVP_PKEY2PKCS8(), but when PKCS8_add_keyusage()
fails this memory is not freed. Fix this by adding a call to
PKCS8_PRIV_KEY_INFO_free().

Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25818)

(cherry picked from commit f822a4866894ed8a752ad93c228fb76a8bb206e8)
crypto/pkcs12/p12_crt.c