mirror of
https://github.com/reactos/reactos.git
synced 2026-05-22 15:20:29 +08:00
[COMPBATT] Free device-related memory only if we failed
Otherwise, we just inserted in the BatteryList this device, and we will probably crash later when accessing it.
This commit is contained in:
@@ -199,8 +199,11 @@ CompBattAddNewBattery(IN PUNICODE_STRING BatteryName,
|
||||
Status);
|
||||
}
|
||||
|
||||
/* Free the battery data */
|
||||
ExFreePool(BatteryData);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Free the battery data */
|
||||
ExFreePool(BatteryData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user