From f316e4cdc9f70526d39b1820c0cff04d71b61d79 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Mon, 21 Jul 2014 19:09:36 -0400 Subject: [PATCH] Bug 1291077 - Remove a use of JS_strdup from Intl.cpp. r=sfink --- js/src/builtin/Intl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index 94d542fcc3af..e3ad4496868c 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -542,13 +542,13 @@ intl_availableLocales(JSContext* cx, CountAvailable countAvailable, RootedValue t(cx, BooleanValue(true)); for (uint32_t i = 0; i < count; i++) { const char* locale = getAvailable(i); - ScopedJSFreePtr lang(JS_strdup(cx, locale)); + auto lang = DuplicateString(cx, locale); if (!lang) return false; char* p; - while ((p = strchr(lang, '_'))) + while ((p = strchr(lang.get(), '_'))) *p = '-'; - RootedAtom a(cx, Atomize(cx, lang, strlen(lang))); + RootedAtom a(cx, Atomize(cx, lang.get(), strlen(lang.get()))); if (!a) return false; if (!DefineProperty(cx, locales, a->asPropertyName(), t, nullptr, nullptr,