Commit 0a91e12cb9 for openssl.org

commit 0a91e12cb9089cf5b618d49042067b40e09f3845
Author: Eugene Syromiatnikov <esyr@openssl.org>
Date:   Thu May 7 16:13:53 2026 +0200

    crypto/evp/evp_lib.c: call va_end() in EVP_PKEY_Q_keygen() on error

    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)

diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c
index 581771a5c0..076efb30d1 100644
--- a/crypto/evp/evp_lib.c
+++ b/crypto/evp/evp_lib.c
@@ -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;
 }