diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index e514ebeeaba59..2a502f20688cc 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -2552,6 +2552,9 @@ static STACK_OF(X509) *php_array_to_X509_sk(zval * zcerts, uint32_t arg_num, con bool free_cert; sk = sk_X509_new_null(); + if (sk == NULL) { + goto clean_exit; + } /* get certs */ if (Z_TYPE_P(zcerts) == IS_ARRAY) { @@ -5797,6 +5800,9 @@ PHP_FUNCTION(openssl_pkcs7_encrypt) } recipcerts = sk_X509_new_null(); + if (recipcerts == NULL) { + goto clean_exit; + } /* get certs */ if (Z_TYPE_P(zrecipcerts) == IS_ARRAY) { @@ -6404,6 +6410,9 @@ PHP_FUNCTION(openssl_cms_encrypt) } recipcerts = sk_X509_new_null(); + if (recipcerts == NULL) { + goto clean_exit; + } /* get certs */ if (Z_TYPE_P(zrecipcerts) == IS_ARRAY) {