- Fix crash when zend_mm_shutdown is called more than once.

This commit is contained in:
Andi Gutmans 2002-06-22 16:09:15 +00:00
parent 58ce28e588
commit 7f226a6b19
2 changed files with 7 additions and 2 deletions

View File

@ -451,8 +451,10 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC)
zend_fast_cache_list_entry *fast_cache_list_entry, *next_fast_cache_list_entry;
#ifdef ZEND_MM
zend_mm_shutdown(&AG(mm_heap));
return;
if (clean_cache) {
zend_mm_shutdown(&AG(mm_heap));
return;
}
#elif defined(ZEND_WIN32) && !ZEND_DEBUG
if (clean_cache && AG(memory_heap)) {
HeapDestroy(AG(memory_heap));

View File

@ -104,6 +104,7 @@ zend_bool zend_mm_add_memory_block(zend_mm_heap *heap, size_t block_size)
if (!segment) {
return 1;
}
/* fprintf(stderr, "Allocating segment %X\n", segment); */
segment->next_segment = heap->segments_list;
heap->segments_list = segment;
@ -147,8 +148,10 @@ void zend_mm_shutdown(zend_mm_heap *heap)
while (segment) {
prev = segment;
segment = segment->next_segment;
/* fprintf(stderr, "Freeing segment %X\n", prev);*/
free(prev);
}
heap->segments_list = NULL;
}
void *zend_mm_alloc(zend_mm_heap *heap, size_t size)