Bug 1459144 - Allocate enough memory for all the processes when deserializing histograms. r=chutten

This is needed as we might end up serializing only one process, but its id might
be greater than 1 when deserializing.

MozReview-Commit-ID: EzXOOhlNV1Y

--HG--
extra : rebase_source : 85c8b32ce1d023cdbd329da2fd5e343c5c2c1941
This commit is contained in:
Alessio Placitelli 2018-05-22 17:12:59 +02:00
parent 3c6c3227f7
commit a665236679

View File

@ -2812,7 +2812,7 @@ TelemetryHistogram::DeserializeHistograms(JSContext* aCx, JS::HandleValue aData)
// Make sure we have enough storage for all the processes.
PersistedHistogramStorage histogramsToUpdate;
if (!histogramsToUpdate.resize(processes.length())) {
if (!histogramsToUpdate.resize(static_cast<uint32_t>(ProcessID::Count))) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -2968,7 +2968,7 @@ TelemetryHistogram::DeserializeKeyedHistograms(JSContext* aCx, JS::HandleValue a
// Make sure we have enough storage for all the processes.
PersistedKeyedHistogramStorage histogramsToUpdate;
if (!histogramsToUpdate.resize(processes.length())) {
if (!histogramsToUpdate.resize(static_cast<uint32_t>(ProcessID::Count))) {
return NS_ERROR_OUT_OF_MEMORY;
}