Add test case to verify that the use after free issue is fixed.
Add test case to verify that the use after free issue is fixed.

Test case based on reproducer by Guido Vranken.

Reviewed-by: Tomas Mraz <2bc6038c3dfca09b2da23c8b6da8ba884dc2dcc2@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17263)

openssl/openssl,openssl/openssl,openssl/openssl,openssl/openssl,openssl/openssl,openssl/openssl