From 1a2419931306bb0905465039dfd773e3bac880d0 Mon Sep 17 00:00:00 2001 From: weili Date: Mon, 12 Sep 2016 15:10:40 -0700 Subject: 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 --- fxjs/cfxjse_class.cpp | 5 +++-- 1 file 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 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); } -- cgit v1.2.3