On 6/22/06, Nuno Lopes <[EMAIL PROTECTED]> wrote:
Hi,

> > @@ -1216,7 +1216,7 @@
> >
> >               p = php_stream_mmap_range(src, php_stream_tell(src),
> > maxlen, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
> >
> > -             if (p) {
> > +             if (p && mapped) {
> >                       *buf = pemalloc_rel_orig(mapped + 1, persistent);
> >
> >                       if (*buf) {


I don't think this "fix" is correct. With your patch, PHP will do more 2
syscalls without any reason (because PHP will try to read the file again).

You'd rather have it if(p) {if(!mapped) return NULL; .... } ?


Anyway, I don't get any memory leak without your patch (at least with PHP
5.2). And take a look at _php_stream_passthru() or
_php_stream_copy_to_stream(). If your patch is correct, these function would
also need to be patched. Again, I get zero leaks.

You need debug build to reproduce it. I reproduced it in 5.1, 5.2 and HEAD..
I however can't reproduce leak in _php_stream_copy_to_stream nor
_php_stream_passthru()

-Hannes

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to