Fix a possible memory leak in do_othername
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 10 Dec 2023 09:18:19 +0000 (10:18 +0100)
committerTomas Mraz <tomas@openssl.org>
Tue, 12 Dec 2023 12:45:57 +0000 (13:45 +0100)
commit8425b1822d21bca77d25a91dac990a3264d1639f
tree136727b7853c9efc97033db023fc461ebe749903
parentee60e1551d34ffae7141657f6504a2201c4bcd20
Fix a possible memory leak in do_othername

Since the gen->type will not be set in a2i_GENERAL_NAME
the gen->d.otherName will not be automatically
cleaned up by GENERAL_NAME_free.
Also fixed a similar leak in a2i_GENERAL_NAME,
where ASN1_STRING_set may fail but gen->d.ia5
will not be automatically cleaned up.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22996)

(cherry picked from commit 1c078212f1548d7f647a1f0f12ed6df257c85cc3)
crypto/x509/v3_san.c
test/recipes/25-test_req.t