diff options
author | Dmitry Belyavskiy <beldmit@gmail.com> | 2022-03-07 17:05:57 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2022-03-10 14:10:53 +0000 |
commit | 175355923046921a689b500f7a72455f7095708f (patch) | |
tree | ec7931fe4046375f93caa248488e52c77475125f /crypto | |
parent | 625b0990a069a18917341e2f0fbe36327b0883b7 (diff) |
Avoid potential memory leak
Resolves #17827
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17828)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/x509/v3_utl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/x509/v3_utl.c b/crypto/x509/v3_utl.c index ae53554e58..688c2ee722 100644 --- a/crypto/x509/v3_utl.c +++ b/crypto/x509/v3_utl.c @@ -539,8 +539,11 @@ static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, return 0; emtmp = OPENSSL_strndup((char *)email->data, email->length); - if (emtmp == NULL) + if (emtmp == NULL) { + X509_email_free(*sk); + *sk = NULL; return 0; + } /* Don't add duplicates */ if (sk_OPENSSL_STRING_find(*sk, emtmp) != -1) { |