efree() crash when used in a shutdown function

php.internals

Frank M. Kromann

22 years ago
Hi, From the pecl/printer extension: static void php_printer_shutdown(zend_printer_globals *printer_globals TSRMLS_DC) { if (printer_globals->default_printer) { efree(printer_globals->default_printer); } } PHP_MINIT_FUNCTION(printer) { ZEND_INIT_MODULE_GLOBALS(printer, php_printer_init, php_printer_shutdown); .. This code fails when the module is shutting down. The mudule is compiled against PHP5, and it works fine with PHP4. If I change efree() to free() (and change the estrdup() to strdup()) the code works fine. I have checked the string just before calling efree and it is allocated and has a value. Is there any problem calling efree() from a shutdown function ? - Frank
> Hi, > > stdlib.h is included in line 106 of bindlib_w32\conf\portability.h.
This
> causes the linker to look for __pctype and __mb_cur_max. This is not a > problem for the old style builds but with Wez' new build system it
causes