Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0-staging] Fix native leak in CryptoNative_GetX509nameInfo #100793

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/native/libs/System.Security.Cryptography.Native/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ BIO* CryptoNative_GetX509NameInfo(X509* x509, int32_t nameType, int32_t forIssue
break;
}

STACK_OF(GENERAL_NAME)* altNames = (STACK_OF(GENERAL_NAME)*)(
X509_get_ext_d2i(x509, forIssuer ? NID_issuer_alt_name : NID_subject_alt_name, NULL, NULL));
GENERAL_NAMES* altNames = (GENERAL_NAMES*)
X509_get_ext_d2i(x509, forIssuer ? NID_issuer_alt_name : NID_subject_alt_name, NULL, NULL);

if (altNames)
{
Expand Down Expand Up @@ -686,13 +686,13 @@ BIO* CryptoNative_GetX509NameInfo(X509* x509, int32_t nameType, int32_t forIssue
{
BIO* b = BIO_new(BIO_s_mem());
ASN1_STRING_print_ex(b, str, ASN1_STRFLGS_UTF8_CONVERT);
sk_GENERAL_NAME_free(altNames);
GENERAL_NAMES_free(altNames);
return b;
}
}
}

sk_GENERAL_NAME_free(altNames);
GENERAL_NAMES_free(altNames);
}
}

Expand Down
Loading