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>
This commit is contained in:
parent
ada5de7ca1
commit
8e0a94a58a
1 changed files with 3 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue