Commit ef46412b authored by raymes's avatar raymes Committed by Commit bot

Ensure that the ppp_class_data is freed when a PluginObject isn't created

PluginObject creation can fail if there isn't a valid V8 context. In this
case we need to take care to free the ppp_class_data.

BUG=594926

Review URL: https://codereview.chromium.org/1805303002

Cr-Commit-Position: refs/heads/master@{#381605}
parent 63413cfe
......@@ -79,8 +79,10 @@ PP_Var PluginObject::Create(PepperPluginInstanceImpl* instance,
// If the V8 context is empty, we may be in the process of tearing down the
// frame and may not have a valid isolate (in particular due to re-entrancy).
// We shouldn't try to call gin::CreateHandle.
if (try_catch.GetContext().IsEmpty())
if (try_catch.GetContext().IsEmpty()) {
ppp_class->Deallocate(ppp_class_data);
return PP_MakeUndefined();
}
gin::Handle<PluginObject> object =
gin::CreateHandle(instance->GetIsolate(),
new PluginObject(instance, ppp_class, ppp_class_data));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment