Messages in this thread | | | From | Frank Lee <> | Date | Sun, 20 Jan 2019 00:08:35 +0800 | Subject | Re: [PATCH] PM / devfreq: fix mem leak and missing check of return value in devfreq_add_device() |
| |
> Also, you better to add following codes to free the memory of > 'devfreq->trans_table' and 'devfreq->time_in_state' because this patch > handles the memory leak of 'trans_table' and 'time_in_state' > variables. Hi Chanwoo:
Isn't that the mem requested by the devm_ API automatically freed when the device is detached? So we don't need to pay attention to free these mem.
Thanks, Yangtao > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index 0ae3de7..945f5f1 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -593,6 +593,9 @@ static void devfreq_dev_release(struct device *dev) > devfreq->profile->exit(devfreq->dev.parent); > > mutex_destroy(&devfreq->lock); > + kfree(devfreq->trans_table); > + kfree(devfreq->time_in_state); > kfree(devfreq); > } > > -- > Best Regards, > Chanwoo Choi > Samsung Electronics
| |