summaryrefslogtreecommitdiffstats
path: root/apps/req.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/req.c')
-rw-r--r--apps/req.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/req.c b/apps/req.c
index 45de46d393..76b337f6bc 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -1588,6 +1588,13 @@ static EVP_PKEY_CTX *set_keygen_ctx(const char *gstr,
*pkeytype = OPENSSL_strndup(keytype, keytypelen);
else
*pkeytype = OPENSSL_strdup(keytype);
+
+ if (*pkeytype == NULL) {
+ BIO_printf(bio_err, "Out of memory\n");
+ EVP_PKEY_free(param);
+ return NULL;
+ }
+
if (keylen >= 0)
*pkeylen = keylen;