Re: [PHP-DEV] PHP 4.0 Bug #2795: Memory Leak in base64_encode() From: Sascha Schumann (sascha <email protected>)
Date: 11/23/99

On Tue, Nov 23, 1999 at 09:32:05AM -0600, Andrei Zmievski wrote:
> On Tue, 23 Nov 1999, evan715 <email protected> wrote:
> > When compiled as a CGI, PHP prints the following:
> >
> > [root <email protected> php4]# ./php -f cy
> > cgi_main.c(323) : Freeing 0x080F4010 (3 bytes), script=cy
> > ZGZkZmRmZA==[root <email protected> php4]#
> >
> > The script 'cy' contains:
> >
> > <?
> > $i = "dfdfdfd";
> > echo base64_encode($i);
> > ?>
>
> It's not base64_encode() problem. If you look at line 323 in cgi_main.c:
>
> SG(request_info).path_translated = estrdup(optarg);
>
> Which never gets freed. I'm not sure exactly where it should be freed
> and under what conditions. Sascha, Zeev?

    Line 323 is the only place where new memory is allocated for
    path_translated. Either allocate always new memory (and free
    accordingly), or mark the special situation with a flag which
    causes path_translated to be freed at the end of main().

-- 

Regards,

Sascha Schumann Consultant

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>