mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00: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:
parent
2323dbcb4f
commit
05ae94092e
1 changed files with 5 additions and 2 deletions
|
@ -199,9 +199,12 @@ CompBattAddNewBattery(IN PUNICODE_STRING BatteryName,
|
||||||
Status);
|
Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
/* Free the battery data */
|
/* Free the battery data */
|
||||||
ExFreePool(BatteryData);
|
ExFreePool(BatteryData);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Fail, no memory */
|
/* Fail, no memory */
|
||||||
|
|
Loading…
Reference in a new issue