mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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.
This commit is contained in:
parent
e1a25ff2ed
commit
10d43c40dd
1 changed files with 2 additions and 5 deletions
|
@ -336,6 +336,8 @@ static size_t zend_shared_alloc_get_largest_free_block(void)
|
||||||
|
|
||||||
void *zend_shared_alloc(size_t size)
|
void *zend_shared_alloc(size_t size)
|
||||||
{
|
{
|
||||||
|
ZEND_ASSERT(ZCG(locked));
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
unsigned int block_size = ZEND_ALIGNED_SIZE(size);
|
unsigned int block_size = ZEND_ALIGNED_SIZE(size);
|
||||||
|
|
||||||
|
@ -343,11 +345,6 @@ void *zend_shared_alloc(size_t size)
|
||||||
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Possible integer overflow in shared memory allocation (%zu + %zu)", size, PLATFORM_ALIGNMENT);
|
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Possible integer overflow in shared memory allocation (%zu + %zu)", size, PLATFORM_ALIGNMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
|
||||||
if (!ZCG(locked)) {
|
|
||||||
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Shared memory lock not obtained");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (block_size > ZSMMG(shared_free)) { /* No hope to find a big-enough block */
|
if (block_size > ZSMMG(shared_free)) { /* No hope to find a big-enough block */
|
||||||
SHARED_ALLOC_FAILED();
|
SHARED_ALLOC_FAILED();
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue