Preserve invariant between saved array and lifetime variables' saved fields on OOM during analysis, bug 735045. r=luke

This commit is contained in:
Brian Hackett 2012-04-10 12:16:42 -07:00
Родитель e483eb5ff5
Коммит 63b74ed81b
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -1048,13 +1048,14 @@ ScriptAnalysis::killVariable(JSContext *cx, LifetimeVariable &var, unsigned offs
{ {
if (!var.lifetime) { if (!var.lifetime) {
/* Make a point lifetime indicating the write. */ /* Make a point lifetime indicating the write. */
if (!var.saved) Lifetime *lifetime = cx->typeLifoAlloc().new_<Lifetime>(offset, var.savedEnd, var.saved);
saved[savedCount++] = &var; if (!lifetime) {
var.saved = cx->typeLifoAlloc().new_<Lifetime>(offset, var.savedEnd, var.saved);
if (!var.saved) {
setOOM(cx); setOOM(cx);
return; return;
} }
if (!var.saved)
saved[savedCount++] = &var;
var.saved = lifetime;
var.saved->write = true; var.saved->write = true;
var.savedEnd = 0; var.savedEnd = 0;
return; return;