Re: PHP 4.0 Bug #2795: Memory Leak in base64_encode()
| From: | Sascha Schumann | Date: | Tue, 23 Nov 1999 15:44:12 +0000 |
| Subject: | Re: PHP 4.0 Bug #2795: Memory Leak in base64_encode() | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-12999@lists.php.net to get a copy of this message | ||
On Tue, Nov 23, 1999 at 09:32:05AM -0600, Andrei Zmievski wrote:
> On Tue, 23 Nov 1999, evan715@sirius.com wrote:
> > When compiled as a CGI, PHP prints the following:
> >
> > [root@localhost php4]# ./php -f cy
> > cgi_main.c(323) : Freeing 0x080F4010 (3 bytes), script=cy
> > ZGZkZmRmZA==[root@localhost 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