From a47a82f4f3ab55ca5438ce8c72c2060a0587624e Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Thu, 9 Dec 2021 09:31:20 -0500 Subject: [PATCH] Allocate less memory for EG(errors) when recording errors for opcache errors is an array of pointers, not an array of values. Low importance since this is freed after opcache compiles a file and there are typically no or very few errors. --- Zend/zend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index e42fc648a4dc7..c37cd9ed97453 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1331,7 +1331,7 @@ ZEND_API ZEND_COLD void zend_error_zstr_at( /* This is very inefficient for a large number of errors. * Use pow2 realloc if it becomes a problem. */ EG(num_errors)++; - EG(errors) = erealloc(EG(errors), sizeof(zend_error_info) * EG(num_errors)); + EG(errors) = erealloc(EG(errors), sizeof(zend_error_info*) * EG(num_errors)); EG(errors)[EG(num_errors)-1] = info; } @@ -1575,7 +1575,7 @@ ZEND_API ZEND_COLD void zend_error_zstr(int type, zend_string *message) { ZEND_API void zend_begin_record_errors(void) { - ZEND_ASSERT(!EG(record_errors) && "Error recoreding already enabled"); + ZEND_ASSERT(!EG(record_errors) && "Error recording already enabled"); EG(record_errors) = true; EG(num_errors) = 0; EG(errors) = NULL;