Skip to content

Commit

Permalink
mfd: core: Fix memory leak of 'cell'
Browse files Browse the repository at this point in the history
When creating a platform device from an MFD cell description, we
allocate some memory and make a copy which is then stored inside the
platform_device's structure.  However, care is not currently taken to
free the allocated memory when the platform device is torn down.

This patch takes care of the leak.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
Lee Jones committed Jul 16, 2020
1 parent 46b5780 commit 126f337
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mfd/mfd-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ static int mfd_remove_devices_fn(struct device *dev, void *data)
regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies,
cell->num_parent_supplies);

kfree(cell);

platform_device_unregister(pdev);

return 0;
}

Expand Down

0 comments on commit 126f337

Please sign in to comment.