Re: com php-src: fix leak in 5.6: ext/session/mod_files.c
| From: | Yasuo Ohgaki | Date: | Sat, 30 Jan 2016 02:03:50 +0000 |
| Subject: | Re: com php-src: fix leak in 5.6: ext/session/mod_files.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-90828@lists.php.net to get a copy of this message | ||
Hi Anatol,
I'm just curious which case causes memory leak.
php_rshutdown_globals() is always called at shutdown and s_close()
should clean them up.
http://lxr.php.net/xref/PHP_5_6/ext/session/session.c#104
Thank you.
--
Yasuo Ohgaki
yohgaki@ohgaki.net
On Fri, Jan 29, 2016 at 9:56 PM, Anatol Belski <ab@php.net> wrote:
> Commit: fa548e5ca9b275ac383cadddde0f4e6d9a806f24
> Author: Anatol Belski <ab@php.net> Fri, 29 Jan 2016 13:56:11 +0100
> Parents: 4b0feeb8fabb2be2c5e5c3ab8d4cfac733651344
> Branches: PHP-5.6 PHP-7.0 master
>
> Link: Q"÷8!©±H
> qhttp://git.php.net/?p=php-src.git;a=commitdiff;h=fa548e5ca9b275ac383cadddde0f4e6d9a806f24
>
> Log:
> fix leak in 5.6
>
> Changed paths:
> M ext/session/mod_files.c
>
>
> Diff:
> diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
> index 7e37381..06659e3 100644
> --- a/ext/session/mod_files.c
> +++ b/ext/session/mod_files.c
> @@ -361,6 +361,18 @@ PS_READ_FUNC(files)
> }
>
> if (!PS(id)) {
> + if (data) {
> + if (data->lastkey) {
> + efree(data->lastkey);
> + data->lastkey = NULL;
> + }
> + if (data->basedir) {
> + efree(data->basedir);
> + data->basedir = NULL;
> + }
> + efree(data);
> + *mod_data = NULL;
> + }
> return FAILURE;
> }
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>