Bug 1100493 - Call js_ReportOutOfMemory on all failure paths in refillFreeList; r=jorendorff

This commit is contained in:
Terrence Cole 2014-12-04 09:41:12 -08:00
parent 428fcb7c71
commit 156ac59ca4
2 changed files with 8 additions and 2 deletions

View File

@ -3051,6 +3051,7 @@ GCRuntime::refillFreeListFromMainThread(JSContext *cx, AllocKind thingKind)
// instead of reporting it.
if (!allowGC) {
MOZ_ASSERT(!mustCollectNow);
js_ReportOutOfMemory(cx);
return nullptr;
}
@ -3099,7 +3100,12 @@ GCRuntime::refillFreeListOffMainThread(ExclusiveContext *cx, AllocKind thingKind
while (rt->isHeapBusy())
HelperThreadState().wait(GlobalHelperThreadState::PRODUCER);
return allocator->arenas.allocateFromArena(zone, thingKind, maybeStartBGAlloc);
void *thing = allocator->arenas.allocateFromArena(zone, thingKind, maybeStartBGAlloc);
if (thing)
return thing;
js_ReportOutOfMemory(cx);
return nullptr;
}
/* static */ void *

View File

@ -244,7 +244,7 @@ ShapeTable::search(jsid id, bool adding)
}
}
/* NOTREACHED */
MOZ_CRASH("Shape::search failed to find an expected entry.");
return nullptr;
}