Fix a memory leak in rsa_priv_encode
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 16 Nov 2022 11:32:06 +0000 (12:32 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 16 Dec 2022 18:05:37 +0000 (19:05 +0100)
commit68cec7e9d31fdf05b82a627a82398d8cfb0b915c
tree230b344eb4f6feebb6246cf30d27669fa4f083a4
parent31efcf2c872f8f4d09ad5209ccbf1ada73436775
Fix a memory leak in rsa_priv_encode

If PKCS8_pkey_set0 fails, the memory in rk need to be clear freed
otherwise it is owned by the PKCS8_PRIV_KEY_INFO.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19694)
crypto/rsa/rsa_ameth.c