]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Remove unnecessary sk_GENERAL_NAME_free() calls on NULL
authorNiels Dossche <niels.dossche@ugent.be>
Tue, 5 Nov 2024 15:14:40 +0000 (16:14 +0100)
committerNiels Dossche <niels.dossche@ugent.be>
Tue, 5 Nov 2024 15:14:40 +0000 (16:14 +0100)
There are several calls to sk_GENERAL_NAME_free() where the argument is
actually NULL, there are not necessary.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25877)

crypto/x509/v3_san.c

index 6146062b0dde62e7fdc6d61a0fa1a854cc8de834..dfcebc0a3548742d2c38fb1fad45c42239c2f690 100644 (file)
@@ -308,7 +308,6 @@ static GENERAL_NAMES *v2i_issuer_alt(X509V3_EXT_METHOD *method,
 
     if (gens == NULL) {
         ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
-        sk_GENERAL_NAME_free(gens);
         return NULL;
     }
     for (i = 0; i < num; i++) {
@@ -387,7 +386,6 @@ static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method,
     gens = sk_GENERAL_NAME_new_reserve(NULL, num);
     if (gens == NULL) {
         ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
-        sk_GENERAL_NAME_free(gens);
         return NULL;
     }
 
@@ -483,7 +481,6 @@ GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method,
     gens = sk_GENERAL_NAME_new_reserve(NULL, num);
     if (gens == NULL) {
         ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
-        sk_GENERAL_NAME_free(gens);
         return NULL;
     }