]> 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:30 +0000 (21:33 +0100)
commit61db4145df39a3818b98ffca040712970fcb2d86
tree01f199eaec191203c52f7de9dc3d1805c95676b1
parent3dcf96d2759a7ace64e40b3df1d3a5cf1730510b
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