зеркало из https://github.com/mozilla/pjs.git
Patch xpcshell.cpp to not try to call JS_malloc with 0 bytes.
Patch courtesy Mark G. Adams <madams@livepage.com> r=mccabe This code is part of xpcshell, and doesn't go into the mozilla product. Prior to this fix, xpcshell crashed on startup.
This commit is contained in:
Родитель
754b9b2ab3
Коммит
9dd8c20ce2
|
@ -598,12 +598,15 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
|||
}
|
||||
|
||||
length = argc - i;
|
||||
vector = (jsval*) JS_malloc(cx, length * sizeof(jsval));
|
||||
if (length == 0) {
|
||||
vector = NULL;
|
||||
} else {
|
||||
vector = (jsval*) JS_malloc(cx, length * sizeof(jsval));
|
||||
if (vector == NULL)
|
||||
return 1;
|
||||
}
|
||||
p = vector;
|
||||
|
||||
if (vector == NULL)
|
||||
return 1;
|
||||
|
||||
while (i < argc) {
|
||||
JSString *str = JS_NewStringCopyZ(cx, argv[i]);
|
||||
if (str == NULL)
|
||||
|
@ -612,7 +615,9 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
|||
i++;
|
||||
}
|
||||
argsObj = JS_NewArrayObject(cx, length, vector);
|
||||
JS_free(cx, vector);
|
||||
if (vector) {
|
||||
JS_free(cx, vector);
|
||||
}
|
||||
if (argsObj == NULL)
|
||||
return 1;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче