Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:6219 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66000 invoked by uid 1010); 4 Dec 2003 23:48:12 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 65976 invoked from network); 4 Dec 2003 23:48:11 -0000 Received: from unknown (HELO smtp3.pp.htv.fi) (213.243.153.173) by pb1.pair.com with SMTP; 4 Dec 2003 23:48:11 -0000 Received: from localhost.localdomain (cs181008.pp.htv.fi [213.243.181.8]) by smtp3.pp.htv.fi (Postfix) with ESMTP id 0AA8327B5AE; Fri, 5 Dec 2003 01:48:11 +0200 (EET) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.10/8.12.10) with ESMTP id hB4Nm9ZK022127; Fri, 5 Dec 2003 01:48:09 +0200 Date: Fri, 5 Dec 2003 01:48:09 +0200 (EET) Reply-To: Jani Taskinen To: "Frank M. Kromann" Cc: internals@lists.php.net In-Reply-To: <10705760774960000@9866357972520000.9866341568840000> Message-ID: References: <10705760774960000@9866357972520000.9866341568840000> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] efree() crash when used in a shutdown function (solved) From: sniper@iki.fi (Jani Taskinen) Thank you very much! You solved my problem too. :) --Jani On Thu, 4 Dec 2003, Frank M. Kromann wrote: > >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 >> > tell it does not cause any other problems. >> > >> > - Frank >> > >> > -- >> > PHP Internals - PHP Runtime Development Mailing List >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >