Commit 8e0a94a5 authored by Matt Caswell's avatar Matt Caswell
Browse files

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: default avatarStephen Henson <steve@openssl.org>
parent ada5de7c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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) {