char *read_from_stdin = NULL;
zend_string *backup_phpdbg_compile = NULL;
zend_bool show_help = 0, show_version = 0;
+ void* (*_malloc)(size_t);
+ void (*_free)(void*);
+ void* (*_realloc)(void*, size_t);
+
#ifndef _WIN32
struct sigaction sigio_struct;
EXCEPTION_POINTERS *xp;
__try {
#endif
- void* (*_malloc)(size_t);
- void (*_free)(void*);
- void* (*_realloc)(void*, size_t);
if (show_version || show_help) {
/* It ain't gonna proceed to real execution anyway,
zend_mm_set_custom_handlers(mm_heap, _malloc, _free, _realloc);
}
+ _free = PHPDBG_G(original_free_function);
+
phpdbg_init_list();
sapi_shutdown();
-#ifdef ZTS
- ts_free_id(phpdbg_globals_id);
-#endif
-
if (sapi_name) {
free(sapi_name);
}
}
#ifdef ZTS
+ /* reset to original handlers - otherwise PHPDBG_G() in phpdbg_watch_efree will be segfaulty (with e.g. USE_ZEND_ALLOC=0) */
+ if (!use_mm_wrappers) {
+ zend_mm_set_custom_handlers(zend_mm_get_heap(), _malloc, _free, _realloc);
+ }
+
+ ts_free_id(phpdbg_globals_id);
+
tsrm_shutdown();
#endif