зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1504788 - Part 3: Properly initialize BinASTSourceMetadata when XDR decoding ScriptSource. (r=Waldo)
--HG-- extra : rebase_source : 6bafca89e8886fe33c43958312a598523ca9bfc0 extra : source : 8ed6a977ba83dfc52f46d4b9305e258a054c76c1
This commit is contained in:
Родитель
0e12c5c35f
Коммит
c96e772e70
|
@ -2465,12 +2465,13 @@ ScriptSource::performXDR(XDRState<mode>* xdr)
|
|||
if (mode == XDR_DECODE) {
|
||||
// Use calloc, since we're storing this immediately, and filling it might GC, to
|
||||
// avoid marking bogus atoms.
|
||||
setBinASTSourceMetadata(
|
||||
static_cast<frontend::BinASTSourceMetadata*>(
|
||||
js_calloc(frontend::BinASTSourceMetadata::totalSize(numBinKinds, numStrings))));
|
||||
if (!binASTMetadata_) {
|
||||
auto metadata = static_cast<frontend::BinASTSourceMetadata*>(
|
||||
js_calloc(frontend::BinASTSourceMetadata::totalSize(numBinKinds, numStrings)));
|
||||
if (!metadata) {
|
||||
return xdr->fail(JS::TranscodeResult_Throw);
|
||||
}
|
||||
new (metadata) frontend::BinASTSourceMetadata(numBinKinds, numStrings);
|
||||
setBinASTSourceMetadata(metadata);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < numBinKinds; i++) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче