Bug 1057140 - Revert JS_realloc bustage from bug 1033442; r=sfink
authorTerrence Cole <terrence@mozilla.com>
Mon, 25 Aug 2014 12:28:38 -0700
changeset 201680 f53a9fd07563c8b9217b6ac3dc984d68bb8de2ec
parent 201679 e7d606eeb52c8594ff11ee9aa9ee15f105ec9b40
child 201681 a1a9fb5f37adb6b0449b84ac1dd3a3db95dbcbbe
push id27375
push userryanvm@gmail.com
push dateTue, 26 Aug 2014 19:56:59 +0000
treeherdermozilla-central@f9bfe115fee5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1057140, 1033442
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1057140 - Revert JS_realloc bustage from bug 1033442; r=sfink
js/xpconnect/src/XPCLocale.cpp
--- a/js/xpconnect/src/XPCLocale.cpp
+++ b/js/xpconnect/src/XPCLocale.cpp
@@ -208,18 +208,19 @@ private:
         rv = mDecoder->Convert(src, &srcLength, unichars, &unicharLength);
         if (NS_SUCCEEDED(rv)) {
           // terminate the returned string
           unichars[unicharLength] = 0;
 
           // nsIUnicodeDecoder::Convert may use fewer than srcLength PRUnichars
           if (unicharLength + 1 < srcLength + 1) {
             char16_t *shrunkUnichars =
-              static_cast<char16_t *>(JS_realloc(cx, unichars, srcLength + 1,
-                                                 unicharLength + 1));
+              (char16_t *)JS_realloc(cx, unichars,
+                                     (srcLength + 1) * sizeof(char16_t),
+                                     (unicharLength + 1) * sizeof(char16_t));
             if (shrunkUnichars)
               unichars = shrunkUnichars;
           }
           JSString *str = JS_NewUCString(cx, reinterpret_cast<jschar*>(unichars), unicharLength);
           if (str) {
             rval.setString(str);
             return true;
           }