RT3754: check for NULL pointer
[openssl.git] / crypto / evp / pmeth_gn.c
index 705801fc0252f3fa47102e45b948ac62e5d24ce2..9416e1ab7215fc46244615a98e74ca6f73f3e3d3 100644 (file)
@@ -96,12 +96,17 @@ int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey)
         return -1;
     }
 
-    if (!ppkey)
+    if (ppkey == NULL)
         return -1;
 
-    if (!*ppkey)
+    if (*ppkey == NULL)
         *ppkey = EVP_PKEY_new();
 
+    if (*ppkey == NULL) {
+        EVPerr(EVP_F_EVP_PKEY_PARAMGEN, ERR_R_MALLOC_FAILURE);
+        return -1;
+    }
+
     ret = ctx->pmeth->paramgen(ctx, *ppkey);
     if (ret <= 0) {
         EVP_PKEY_free(*ppkey);