]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
crypto/evp/evp_lib.c: call va_end() in EVP_PKEY_Q_keygen() on error
authorEugene Syromiatnikov <esyr@openssl.org>
Thu, 7 May 2026 14:13:53 +0000 (16:13 +0200)
committerEugene Syromiatnikov <esyr@openssl.org>
Mon, 11 May 2026 00:28:10 +0000 (02:28 +0200)
Instead of returning NULL immediately, jump to the cleanup at the end
of the function.  Reported by Coverity.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1593754
Fixes: 18472994f065 "The EVP_PKEY_Q_keygen function now explicitly handles NULL curve name"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Mon May 11 00:28:25 2026
(Merged from https://github.com/openssl/openssl/pull/31107)

crypto/evp/evp_lib.c

index 581771a5c0b2b9109fb7c3f1998ef02d0fe596a5..076efb30d1e2b6e599318256a8e89008ba5d7035 100644 (file)
@@ -1031,7 +1031,7 @@ EVP_PKEY *EVP_PKEY_Q_keygen(OSSL_LIB_CTX *libctx, const char *propq,
         name = va_arg(args, char *);
         if (name == NULL) {
             ERR_raise(ERR_LIB_EVP, ERR_R_PASSED_NULL_PARAMETER);
-            return NULL;
+            goto end;
         }
         params[0] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME,
             name, 0);
@@ -1039,6 +1039,7 @@ EVP_PKEY *EVP_PKEY_Q_keygen(OSSL_LIB_CTX *libctx, const char *propq,
 
     ret = evp_pkey_keygen(libctx, type, propq, params);
 
+end:
     va_end(args);
     return ret;
 }