mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 14:30:43 +00:00
Bug 328556: Proper accounting for growth in array_join_sub when reallocating
chars array. r=mrbkap
This commit is contained in:
parent
4da6f35ea6
commit
1b5685357f
@ -426,8 +426,8 @@ array_join_sub(JSContext *cx, JSObject *obj, enum ArrayToStringOp op,
|
||||
} else {
|
||||
MAKE_SHARP(he);
|
||||
nchars = js_strlen(chars);
|
||||
chars = (jschar *)
|
||||
realloc((ochars = chars), nchars * sizeof(jschar) + growth);
|
||||
growth += nchars * sizeof(jschar);
|
||||
chars = (jschar *)realloc((ochars = chars), growth);
|
||||
if (!chars) {
|
||||
free(ochars);
|
||||
goto done;
|
||||
|
Loading…
x
Reference in New Issue
Block a user