Bug 1276724 - Make two url-classifier allocations fallible. r=gcp.

This addresses two crashes in the top #75 on 47.0.1.
This commit is contained in:
Nicholas Nethercote
2016-07-29 19:34:20 +10:00
parent 547ed4efcb
commit 9f712249f8
2 changed files with 6 additions and 2 deletions

View File

@@ -787,7 +787,9 @@ HashStore::WriteAddPrefixes(nsIOutputStream* aOut)
{
nsTArray<uint32_t> chunks;
uint32_t count = mAddPrefixes.Length();
chunks.SetCapacity(count);
if (!chunks.SetCapacity(count, fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
for (uint32_t i = 0; i < count; i++) {
chunks.AppendElement(mAddPrefixes[i].Chunk());