Bug 1246157 - avoid memory leak when bindings->init fails. r=jcoppeard

This commit is contained in:
Bogdan Postelnicu 2016-02-08 00:53:00 +01:00
parent f322e3ac40
commit 5027f4c4e1

View File

@ -591,6 +591,7 @@ ModuleObject::create(ExclusiveContext* cx, Handle<StaticScope*> enclosingStaticS
IndirectBindingMap* bindings = zone->new_<IndirectBindingMap>(zone);
if (!bindings || !bindings->init()) {
ReportOutOfMemory(cx);
js_delete<IndirectBindingMap>(bindings);
return nullptr;
}
@ -842,6 +843,7 @@ ModuleObject::createNamespace(JSContext* cx, HandleModuleObject self, HandleArra
IndirectBindingMap* bindings = zone->new_<IndirectBindingMap>(zone);
if (!bindings || !bindings->init()) {
ReportOutOfMemory(cx);
js_delete<IndirectBindingMap>(bindings);
return nullptr;
}