Hi Nikita,

On Sun, October 5, 2014 23:18, Nikita Popov wrote:
> On Thu, Sep 18, 2014 at 5:14 PM, Anatol Belski <a...@php.net> wrote:
>
>
>> Commit:    761e347b7526b18b9901ebf3d906b52a21fc9c4b
>> Author:    Anatol Belski <a...@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=761e347b7526b18b9901ebf
>> 3d906b52a21fc9c4b
>>
>>
>> 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
>
>
I was actually looking for that leaks, but after checking Zend I've just
two valgrind errors

Zend/tests/bug34137.phpt
Zend/tests/bug34260.phpt

which are related to something completely else (some invalid read).


Now it has done a half of ext/standard, but still no leaks. So better I
just ask before waiting half a day for the tests finish - which test
should I take to reproduce this?

I remember why I've done this also. The place in zend_string.c is actually
less relevant as it's free'd on module shutdown anyway, but the other one
in globals ctor - it can lead to crashes in other dtor callbacks when it's
free'd to early (primarily in TS build). And at the end, it probably would
use free(), no?

Regards

Anatol

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to