ASN.1 BIO: properly wire up prefix_free and suffix_free
authortb <tb@openbsd.org>
Fri, 10 Mar 2023 11:55:38 +0000 (11:55 +0000)
committertb <tb@openbsd.org>
Fri, 10 Mar 2023 11:55:38 +0000 (11:55 +0000)
commit3319543d58b112b3563dcc7a55a12a5feb3e62e8
treef87e72e746b7c364cfb21ba3ecd5a989bfdd93b0
parentc5d97e146b0b84b5aaf0732c7ffb8b845cadd04d
ASN.1 BIO: properly wire up prefix_free and suffix_free

If something goes wrong before the ASN.1 BIO state machine has passed
both flushing states, asn1_bio_free() forgets to free the ndef_aux
and the ex_arg since the prefix_free() and suffix_free callbacks are
not called.

This can lead to leaks, notably in streaming bios.

Part of https://github.com/openssl/openssl/pull/15999
I have a regress covering this but it is not yet ready to land.

ok beck jsing
lib/libcrypto/asn1/bio_asn1.c