Re: [PATCH] power: supply: fix memory leaks (v2)

2020-05-02 Thread Sebastian Reichel
Hi, On Sat, May 02, 2020 at 06:33:38PM -0500, wu000...@umn.edu wrote: > From: Qiushi Wu > > In function power_supply_add_hwmon_sysfs(), psyhw->props is > allocated by bitmap_zalloc(). But this pointer is not deallocated > when devm_add_action fail, which lead to a memory leak bug. To fix >

[PATCH] power: supply: fix memory leaks (v2)

2020-05-02 Thread wu000273
From: Qiushi Wu In function power_supply_add_hwmon_sysfs(), psyhw->props is allocated by bitmap_zalloc(). But this pointer is not deallocated when devm_add_action fail, which lead to a memory leak bug. To fix this, we replace devm_add_action with devm_add_action_or_reset. v2: - Prevent

Re: [PATCH] power: supply: fix memory leaks

2020-05-02 Thread Sebastian Reichel
Hi, On Sat, May 02, 2020 at 04:10:56PM -0500, wu000...@umn.edu wrote: > From: Qiushi Wu > > In function power_supply_add_hwmon_sysfs(), psyhw->props is > allocated by bitmap_zalloc(). But this pointer is not deallocated > in several error paths, which lead to memory leak bugs. To fix > this, we

[PATCH] power: supply: fix memory leaks

2020-05-02 Thread wu000273
From: Qiushi Wu In function power_supply_add_hwmon_sysfs(), psyhw->props is allocated by bitmap_zalloc(). But this pointer is not deallocated in several error paths, which lead to memory leak bugs. To fix this, we can call bitmap_free() to free this pointer. Signed-off-by: Qiushi Wu ---