From: Matt Caswell Date: Thu, 26 May 2016 14:54:48 +0000 (+0100) Subject: Check for malloc failure in EVP_PKEY_keygen() X-Git-Tag: OpenSSL_1_0_2i~170 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8e0a94a58a4382296b6c2ba6d7381c48e24e26cd;p=oweals%2Fopenssl.git 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 --- 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) {