Re: com php-src: that's not char * but zend_string *: Zend/zend.c Zend/zend_string.c
| From: | Nikita Popov | Date: | Sun, 05 Oct 2014 21:18:47 +0000 |
| Subject: | Re: com php-src: that's not char * but zend_string *: Zend/zend.c Zend/zend_string.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-82117@lists.php.net to get a copy of this message | ||
On Thu, Sep 18, 2014 at 5:14 PM, Anatol Belski <ab@php.net> wrote:
> Commit: 761e347b7526b18b9901ebf3d906b52a21fc9c4b
> Author: Anatol Belski <ab@php.net> Thu, 18 Sep 2014 17:11:48
> +0200
> Parents: fb848ebd005624f95b7d019eccb660f43aeb571c
> Branches: master
>
> Link:
>
> http://git.php.net/?p=php-src.git;a=commitdiff;h=761e347b7526b18b9901ebf3d906b52a21fc9c4b
>
> Log:
> that's not char * but zend_string *
>
> Changed paths:
> M Zend/zend.c
> M Zend/zend_string.c
>
>
> Diff:
> diff --git a/Zend/zend.c b/Zend/zend.c
> index b646ec2..07171bd 100644
> --- a/Zend/zend.c
> +++ b/Zend/zend.c
> @@ -549,7 +549,7 @@ static void
> compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS
> compiler_globals->last_static_member = 0;
>
> #ifdef ZTS
> - free(compiler_globals->empty_string);
> + zend_string_release(compiler_globals->empty_string);
> #endif
> }
> /* }}} */
> diff --git a/Zend/zend_string.c b/Zend/zend_string.c
> index a9148f2..a4455e8 100644
> --- a/Zend/zend_string.c
> +++ b/Zend/zend_string.c
> @@ -80,7 +80,7 @@ void zend_interned_strings_dtor(TSRMLS_D)
> #ifndef ZTS
> zend_hash_destroy(&CG(interned_strings));
> #else
> - free(CG(empty_string));
> + zend_string_release(CG(empty_string));
> #endif
> }
>
The free() was correct - this is an interned string, so zend_string_release
will do nothing to it. Furthermore you probably also have to destroy the
empty_string initialized by the interned string ctor when you overwrite it.
At least right now valgrind spews out dozens of leakages of the empty
string.
Nikita