diff options
author | weili <weili@chromium.org> | 2016-09-12 15:10:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-12 15:10:40 -0700 |
commit | 1a2419931306bb0905465039dfd773e3bac880d0 (patch) | |
tree | 4d4881ebbc5f59f22ab189810f8f6b7b2cf580df | |
parent | 860a2d0299996d253272d831c9c7e533e9d3e890 (diff) | |
download | pdfium-1a2419931306bb0905465039dfd773e3bac880d0.tar.xz |
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
-rw-r--r-- | fxjs/cfxjse_class.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp index de22af7681..6ccc0e2e24 100644 --- a/fxjs/cfxjse_class.cpp +++ b/fxjs/cfxjse_class.cpp @@ -289,9 +289,10 @@ void NamedPropertySetterCallback( 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); } |