evp_test: address NULL pointer dereference and return failure better
[openssl.git] / test / evp_test.c
index 2310fb7907f2bfc713af4b1f3ca65737cf6a999a..16b1a50c2d9e035c3ee63d865f2f9a23c2f886da 100644 (file)
@@ -2006,8 +2006,10 @@ static int pbe_test_init(EVP_TEST *t, const char *alg)
         pbe_type = PBE_TYPE_PKCS12;
     } else {
         TEST_error("Unknown pbe algorithm %s", alg);
+        return 0;
     }
-    pdat = OPENSSL_zalloc(sizeof(*pdat));
+    if (!TEST_ptr(pdat = OPENSSL_zalloc(sizeof(*pdat))))
+        return 0;
     pdat->pbe_type = pbe_type;
     t->data = pdat;
     return 1;