summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-05-26 15:54:48 +0100
committerMatt Caswell <matt@openssl.org>2016-05-26 16:13:08 +0100
commit8e0a94a58a4382296b6c2ba6d7381c48e24e26cd (patch)
treefac09331c31819d93647d4d852ba7a81262422bb /crypto/evp
parentada5de7ca1deae28713303319694806214dfa7d9 (diff)
Check for malloc failure in EVP_PKEY_keygen()
After a call to EVP_PKEY_new() we should check for malloc failure. RT#4180 Reviewed-by: Stephen Henson <steve@openssl.org>
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/pmeth_gn.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/evp/pmeth_gn.c b/crypto/evp/pmeth_gn.c
index 6435f1b632..6a4d3573ff 100644
--- a/crypto/evp/pmeth_gn.c
+++ b/crypto/evp/pmeth_gn.c
@@ -149,8 +149,10 @@ int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey)
if (!ppkey)
return -1;
- if (!*ppkey)
+ if (*ppkey == NULL)
*ppkey = EVP_PKEY_new();
+ if (*ppkey == NULL)
+ return -1;
ret = ctx->pmeth->keygen(ctx, *ppkey);
if (ret <= 0) {