Skip to content

Commit 25bb229

Browse files
authored
Allocate less memory for EG(errors) when recording errors for opcache (#7744)
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.
1 parent bdcef24 commit 25bb229

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Zend/zend.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ ZEND_API ZEND_COLD void zend_error_zstr_at(
13311331
/* This is very inefficient for a large number of errors.
13321332
* Use pow2 realloc if it becomes a problem. */
13331333
EG(num_errors)++;
1334-
EG(errors) = erealloc(EG(errors), sizeof(zend_error_info) * EG(num_errors));
1334+
EG(errors) = erealloc(EG(errors), sizeof(zend_error_info*) * EG(num_errors));
13351335
EG(errors)[EG(num_errors)-1] = info;
13361336
}
13371337

@@ -1575,7 +1575,7 @@ ZEND_API ZEND_COLD void zend_error_zstr(int type, zend_string *message) {
15751575

15761576
ZEND_API void zend_begin_record_errors(void)
15771577
{
1578-
ZEND_ASSERT(!EG(record_errors) && "Error recoreding already enabled");
1578+
ZEND_ASSERT(!EG(record_errors) && "Error recording already enabled");
15791579
EG(record_errors) = true;
15801580
EG(num_errors) = 0;
15811581
EG(errors) = NULL;

0 commit comments

Comments
 (0)