Skip to content

Commit 12462e4

Browse files
committed
ext/opcache/zend_shared_alloc: change "locked" check to assertion
Calling zend_shared_alloc() without holding the lock is always a bug, not a fatal runtime error.
1 parent 1e148b6 commit 12462e4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

ext/opcache/zend_shared_alloc.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,11 @@ static size_t zend_shared_alloc_get_largest_free_block(void)
360360

361361
void *zend_shared_alloc(size_t size)
362362
{
363+
ZEND_ASSERT(ZCG(locked));
364+
363365
int i;
364366
unsigned int block_size = ZEND_ALIGNED_SIZE(size);
365367

366-
#if 1
367-
if (!ZCG(locked)) {
368-
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Shared memory lock not obtained");
369-
}
370-
#endif
371368
if (block_size > ZSMMG(shared_free)) { /* No hope to find a big-enough block */
372369
SHARED_ALLOC_FAILED();
373370
return NULL;

0 commit comments

Comments
 (0)