Bug 1141081: Ensure nsPluginInstanceOwner::Destroy is called before returning from failed plugin instantiation; r=jimm

--HG--
extra : rebase_source : 066ea5acbfdb2df1976fa12675cc267d1f417564
This commit is contained in:
Aaron Klotz 2015-03-17 19:44:34 -06:00
Родитель c64dbd1ed9
Коммит 081c02fb8a
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -811,17 +811,20 @@ nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aUR
nsPluginTagType tagType;
rv = instanceOwner->GetTagType(&tagType);
if (NS_FAILED(rv)) {
instanceOwner->Destroy();
return rv;
}
if (tagType != nsPluginTagType_Embed &&
tagType != nsPluginTagType_Applet &&
tagType != nsPluginTagType_Object) {
instanceOwner->Destroy();
return NS_ERROR_FAILURE;
}
rv = SetUpPluginInstance(aMimeType, aURL, instanceOwner);
if (NS_FAILED(rv)) {
instanceOwner->Destroy();
return NS_ERROR_FAILURE;
}
const bool isAsyncInit = (rv == NS_PLUGIN_INIT_PENDING);
@ -829,6 +832,7 @@ nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aUR
nsRefPtr<nsNPAPIPluginInstance> instance;
rv = instanceOwner->GetInstance(getter_AddRefs(instance));
if (NS_FAILED(rv)) {
instanceOwner->Destroy();
return rv;
}