OSSL_parse_url() allocates a 1-byte empty-string buffer for the scheme
even when the URI has no scheme. The empty-scheme error branch freed
uri_copy and jumped to end: which only frees host, leaving scheme
unfreed. Add OPENSSL_free(scheme) before the goto.
Assisted-by: Claude:claude-sonnet-4-6
CLA: trivial
Fixes: e599893a9fec "x509: allow SAN URIs to contain userinfo"
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Jun 26 15:26:09 2026
(Merged from https://github.com/openssl/openssl/pull/31678)
if (scheme == NULL || *scheme == '\0') {
ERR_raise_data(ERR_LIB_X509V3, X509_V_ERR_UNSUPPORTED_NAME_SYNTAX,
"x509: missing scheme in URI: %s\n", uri_copy);
+ OPENSSL_free(scheme);
OPENSSL_free(uri_copy);
ret = X509_V_ERR_UNSUPPORTED_NAME_SYNTAX;
goto end;