]> granicus.if.org Git - php/commitdiff
fix leaking of locale_string in TS build
authorAnatol Belski <ab@php.net>
Tue, 20 Jan 2015 19:46:45 +0000 (20:46 +0100)
committerAnatol Belski <ab@php.net>
Tue, 20 Jan 2015 19:52:44 +0000 (20:52 +0100)
actually more like an attempt as i see the leaks on travis,
but don't repro on my boxes

ext/standard/string.c

index fc25456c555e451dd166ac8f1f0f889ba7d3427b..dc69a8a3ac193eeac3fc8628e91573486bf87653 100644 (file)
@@ -4550,11 +4550,12 @@ 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(zend_string_copy(BG(locale_string)));
                                        }
-                                       RETURN_STR(zend_string_copy(BG(locale_string)));
                                } else if (len == loc->len && !memcmp(loc->val, retval, len)) {
                                        RETURN_STR(loc);
                                }