diff options
author | Anatol Belski <ab@php.net> | 2014-10-06 15:44:43 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-10-06 15:48:55 +0200 |
commit | 741bf0ee9626c9342de1175244d9e9e4ad9c69f4 (patch) | |
tree | d4042b862a97fea3878a3fc52a50de18355e6c8c /Zend/zend_string.h | |
parent | cc7c14cb76013c8a66b74cfb423135d41a709403 (diff) | |
download | php-git-741bf0ee9626c9342de1175244d9e9e4ad9c69f4.tar.gz |
fix the empty_strings SAPI shutdown leak in TS build
still the NTS variant is somewhat different as it needs
zend_new_interned_string_int because the normal callbacks might
be not initialized, but at least no leaks anymore and some more
structure
Diffstat (limited to 'Zend/zend_string.h')
-rw-r--r-- | Zend/zend_string.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Zend/zend_string.h b/Zend/zend_string.h index d30e14b5b3..1da3b511c0 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -282,6 +282,30 @@ EMPTY_SWITCH_DEFAULT_CASE() return hash; } +static zend_always_inline void zend_interned_empty_string_init(zend_string **s TSRMLS_DC) +{ + zend_string *str; + + str = zend_string_alloc(sizeof("")-1, 1); + str->val[0] = '\000'; + +#ifndef ZTS + *s = zend_new_interned_string(str TSRMLS_CC); +#else + zend_string_hash_val(str); + str->gc.u.v.flags |= IS_STR_INTERNED; + *s = str; +#endif +} + +static zend_always_inline void zend_interned_empty_string_free(zend_string **s TSRMLS_DC) +{ + if (NULL != *s) { + free(*s); + *s = NULL; + } +} + #endif /* ZEND_STRING_H */ /* |