Fix leaked value object in NamedPropertySetterCallback()
When setting a new value for a V8 object property, the passed along
pointer of CFXJSE_Value is only used, but needs to be released by the
original owner. Use unique_ptr to have the pointer released
automatically.
BUG=pdfium:242
Review-Url: https://codereview.chromium.org/2328273004
diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp
index de22af7..6ccc0e2 100644
--- a/fxjs/cfxjse_class.cpp
+++ b/fxjs/cfxjse_class.cpp
@@ -289,9 +289,10 @@
new CFXJSE_Value(info.GetIsolate()));
lpThisValue->ForceSetValue(thisObject);
- CFXJSE_Value* lpNewValue = new CFXJSE_Value(info.GetIsolate());
+ std::unique_ptr<CFXJSE_Value> lpNewValue(new CFXJSE_Value(info.GetIsolate()));
lpNewValue->ForceSetValue(value);
- DynPropSetterAdapter(lpClass, lpThisValue.get(), szFxPropName, lpNewValue);
+ DynPropSetterAdapter(lpClass, lpThisValue.get(), szFxPropName,
+ lpNewValue.get());
info.GetReturnValue().Set(value);
}