diff options
author | Xinchen Hui <laruence@php.net> | 2015-03-09 11:19:05 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2015-03-09 11:19:05 +0800 |
commit | 96f7a33df6e72dc855b82140ab10ddeaaf19b20c (patch) | |
tree | fe7355054be216794039feb1cdedaa7e45600979 /sapi/phpdbg/phpdbg.c | |
parent | 69d183dd1926c4f1b35f9303e6960732f71e29de (diff) | |
download | php-git-96f7a33df6e72dc855b82140ab10ddeaaf19b20c.tar.gz |
Temorary fix for phpdbg segfault while use zend_mm_set_custom_handlers
Diffstat (limited to 'sapi/phpdbg/phpdbg.c')
-rw-r--r-- | sapi/phpdbg/phpdbg.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 74bf84adff..a12811fb87 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -983,7 +983,14 @@ void *phpdbg_malloc_wrapper(size_t size) /* {{{ */ void phpdbg_free_wrapper(void *p) /* {{{ */ { - zend_mm_free(phpdbg_mm_get_heap(), p); + zend_mm_heap *heap = phpdbg_mm_get_heap(); + if (UNEXPECTED(heap == p)) { + /* TODO: heap maybe allocated by mmap(zend_mm_init) or malloc(USE_ZEND_ALLOC=0) + * let's prevent it from segfault for now + */ + } else { + zend_mm_free(heap, p); + } } /* }}} */ void *phpdbg_realloc_wrapper(void *ptr, size_t size) /* {{{ */ |