mirror of
https://github.com/php/php-src.git
synced 2024-12-20 07:20:33 +08:00
fix premature freeing of BG(locale_string)
the returned string has to be refcounted
This commit is contained in:
parent
57162a97bc
commit
ea8415114a
@ -4550,12 +4550,11 @@ PHP_FUNCTION(setlocale)
|
||||
}
|
||||
if (len == loc->len && !memcmp(loc->val, retval, len)) {
|
||||
BG(locale_string) = zend_string_copy(loc);
|
||||
RETURN_STR(BG(locale_string));
|
||||
} else {
|
||||
BG(locale_string) = zend_string_init(retval, len, 0);
|
||||
zend_string_release(loc);
|
||||
RETURN_STR(BG(locale_string));
|
||||
}
|
||||
RETURN_STR(zend_string_copy(BG(locale_string)));
|
||||
} else if (len == loc->len && !memcmp(loc->val, retval, len)) {
|
||||
RETURN_STR(loc);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user