summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/opcache/ZendAccelerator.c9
-rw-r--r--ext/opcache/zend_shared_alloc.c2
2 files changed, 9 insertions, 2 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index c2ff267606..812b4481eb 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1361,9 +1361,15 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
#ifdef __SSE2__
/* Align to 64-byte boundary */
ZCG(mem) = zend_shared_alloc(memory_used + 64);
- ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 63L) & ~63L);
+ if (ZCG(mem)) {
+ memset(ZCG(mem), 0, memory_used + 64);
+ ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 63L) & ~63L);
+ }
#else
ZCG(mem) = zend_shared_alloc(memory_used);
+ if (ZCG(mem)) {
+ memset(ZCG(mem), 0, memory_used);
+ }
#endif
if (!ZCG(mem)) {
zend_shared_alloc_destroy_xlat_table();
@@ -2542,6 +2548,7 @@ static int zend_accel_init_shm(void)
zend_shared_alloc_unlock();
return FAILURE;
}
+ memset(accel_shared_globals, 0, sizeof(zend_accel_shared_globals));
ZSMMG(app_shared_globals) = accel_shared_globals;
zend_accel_hash_init(&ZCSG(hash), ZCG(accel_directives).max_accelerated_files);
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index b7940ad39b..738c6285d2 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -230,6 +230,7 @@ int zend_shared_alloc_startup(size_t requested_size)
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
return ALLOC_FAILURE;;
}
+ memset(p_tmp_shared_globals, 0, sizeof(zend_smm_shared_globals));
tmp_shared_segments = zend_shared_alloc(shared_segments_array_size + ZSMMG(shared_segments_count) * sizeof(void *));
if (!tmp_shared_segments) {
@@ -325,7 +326,6 @@ void *zend_shared_alloc(size_t size)
ZSMMG(shared_segments)[i]->pos += block_size;
ZSMMG(shared_free) -= block_size;
- memset(retval, 0, block_size);
ZEND_ASSERT(((zend_uintptr_t)retval & 0x7) == 0); /* should be 8 byte aligned */
return retval;
}