Set error code on alloc failures
[openssl.git] / crypto / evp / bio_ok.c
index 5871e632b52eefa633e7133fbe19faf5880f44dd..05fc1a22bf39b3445987728497a67e33d45c6ef2 100644 (file)
@@ -133,9 +133,10 @@ static int ok_new(BIO *bi)
 {
     BIO_OK_CTX *ctx;
 
-    ctx = OPENSSL_zalloc(sizeof(*ctx));
-    if (ctx == NULL)
+    if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
+        EVPerr(EVP_F_OK_NEW, ERR_R_MALLOC_FAILURE);
         return 0;
+    }
 
     ctx->cont = 1;
     ctx->sigio = 1;