no bug - Create batteryInfo on the stack. rs=Ms2ger a=Ms2ger
authorMounir Lamouri <mounir.lamouri@gmail.com>
Wed, 14 Dec 2011 11:40:29 +0100
changeset 84532 fd6ab19f312ca587ac73500eedb603736b0e5806
parent 84531 ffea93b21d4d78de21b1ba5e6933698cbd6a6480
child 84533 9df183d280bafd4b67e65d5df9a4ba5dcde9bcb0
push id114
push userffxbld
push dateFri, 09 Mar 2012 01:01:18 +0000
treeherdermozilla-release@c081ebf13261 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger, Ms2ger
milestone11.0a1
first release with
nightly win32
fd6ab19f312c / 11.0a1 / 20111214031134 / files
nightly win64
fd6ab19f312c / 11.0a1 / 20111214031134 / files
nightly linux32
nightly linux64
nightly mac
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly win32
nightly win64
no bug - Create batteryInfo on the stack. rs=Ms2ger a=Ms2ger
dom/battery/BatteryManager.cpp
--- a/dom/battery/BatteryManager.cpp
+++ b/dom/battery/BatteryManager.cpp
@@ -95,22 +95,20 @@ void
 BatteryManager::Init(nsPIDOMWindow *aWindow, nsIScriptContext* aScriptContext)
 {
   // Those vars come from nsDOMEventTargetHelper.
   mOwner = aWindow;
   mScriptContext = aScriptContext;
 
   hal::RegisterBatteryObserver(this);
 
-  hal::BatteryInformation* batteryInfo = new hal::BatteryInformation();
-  hal::GetCurrentBatteryInformation(batteryInfo);
+  hal::BatteryInformation batteryInfo;
+  hal::GetCurrentBatteryInformation(&batteryInfo);
 
-  UpdateFromBatteryInfo(*batteryInfo);
-
-  delete batteryInfo;
+  UpdateFromBatteryInfo(batteryInfo);
 }
 
 void
 BatteryManager::Shutdown()
 {
   hal::UnregisterBatteryObserver(this);
 }