Re: efree() crash when used in a shutdown function (solved)

php.internals

Frank M. Kromann

22 years ago
Hi, It helps to break for lunch. Making this variable persistant solved the problem. - Frank
> 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 > > a linking problem. > > > > Removing line 106 form this file solves the problem and as far as I
can

Jani Taskinen

22 years ago
Thank you very much! You solved my problem too. :) --Jani On Thu, 4 Dec 2003, Frank M. Kromann wrote: