Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / renderer / pepper / plugin_object.cc
index 62a9365..256c0a3 100644 (file)
@@ -43,10 +43,11 @@ NPObject* WrapperClass_Allocate(NPP npp, NPClass* unused) {
 
 void WrapperClass_Deallocate(NPObject* np_object) {
   PluginObject* plugin_object = PluginObject::FromNPObject(np_object);
-  if (!plugin_object)
-    return;
-  plugin_object->ppp_class()->Deallocate(plugin_object->ppp_class_data());
-  delete plugin_object;
+  if (plugin_object) {
+    plugin_object->ppp_class()->Deallocate(plugin_object->ppp_class_data());
+    delete plugin_object;
+  }
+  delete np_object;
 }
 
 void WrapperClass_Invalidate(NPObject* object) {}
@@ -207,7 +208,8 @@ bool WrapperClass_Enumerate(NPObject* object,
           calloc(property_count, sizeof(NPIdentifier)));
       *count = 0;  // Will be the number of items successfully converted.
       for (uint32_t i = 0; i < property_count; ++i) {
-        if (!((*values)[i] = PPVarToNPIdentifier(properties[i]))) {
+        (*values)[i] = PPVarToNPIdentifier(properties[i]);
+        if (!(*values)[i]) {
           // Throw an exception for the failed convertion.
           *result_converter.exception() =
               StringVar::StringToPPVar(kInvalidValueException);