diff options
author | Beat Bolli <dev@drbeat.li> | 2024-08-15 12:35:02 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-08-21 15:51:29 +0200 |
commit | 223e0020e47e6e8eb6079258ea9d563d1d115132 (patch) | |
tree | 653a83f4b97c7e93df4791d6dc2d2a7d1136e7b7 | |
parent | Add Changes entry for debuginfo generation (diff) | |
download | openssl-223e0020e47e6e8eb6079258ea9d563d1d115132.tar.xz openssl-223e0020e47e6e8eb6079258ea9d563d1d115132.zip |
x_attrib: fix a memory leak
The X509_NAME object needs to be free'd even if printing it fails.
Introduced in be5adfd6e3 ("Support subjectDirectoryAttributes and
associatedInformation exts", 2024-06-18), but subsequently moved in
7bcfb41489 ("ossl_print_attribute_value(): use a sequence value only if
type is a sequence", 2024-08-05).
Signed-off-by: Beat Bolli <dev@drbeat.li>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25207)
-rw-r--r-- | crypto/x509/x_attrib.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/x509/x_attrib.c b/crypto/x509/x_attrib.c index b413a27917..2623398deb 100644 --- a/crypto/x509/x_attrib.c +++ b/crypto/x509/x_attrib.c @@ -98,6 +98,7 @@ int ossl_print_attribute_value(BIO *out, unsigned char *value; X509_NAME *xn = NULL; int64_t int_val; + int ret = 1; switch (av->type) { case V_ASN1_BOOLEAN: @@ -192,9 +193,9 @@ int ossl_print_attribute_value(BIO *out, return 0; } if (X509_NAME_print_ex(out, xn, indent, XN_FLAG_SEP_CPLUS_SPC) <= 0) - return 0; + ret = 0; X509_NAME_free(xn); - return 1; + return ret; default: break; |