fix premature freeing of BG(locale_string)

the returned string has to be refcounted
This commit is contained in:
Anatol Belski 2015-01-20 16:52:49 +01:00
parent 57162a97bc
commit ea8415114a

View File

@ -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);
}