RE: [PATCH] PM / devfreq: fix mem leak and missing check of return value in devfreq_add_device()

2019-01-20 Thread MyungJoo Ham
> 'devfreq' is malloced in devfreq_add_device() and should be freed in > the error handling cases, otherwise it will cause memory leak. > > devm_kzalloc() could fail, so insert a check of its return value. And > if it fails, returns -ENOMEM. > > Signed-off-by: Yangtao Li Dear Yangtao, Could

Re: [PATCH] PM / devfreq: fix mem leak and missing check of return value in devfreq_add_device()

2019-01-19 Thread Frank Lee
> 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

Re: [PATCH] PM / devfreq: fix mem leak and missing check of return value in devfreq_add_device()

2019-01-19 Thread Chanwoo Choi
Hi Yangtao, 2019년 1월 19일 (토) 오후 2:03, Yangtao Li 님이 작성: > > 'devfreq' is malloced in devfreq_add_device() and should be freed in > the error handling cases, otherwise it will cause memory leak. > > devm_kzalloc() could fail, so insert a check of its return value. And > if it fails, returns

[PATCH] PM / devfreq: fix mem leak and missing check of return value in devfreq_add_device()

2019-01-18 Thread Yangtao Li
'devfreq' is malloced in devfreq_add_device() and should be freed in the error handling cases, otherwise it will cause memory leak. devm_kzalloc() could fail, so insert a check of its return value. And if it fails, returns -ENOMEM. Signed-off-by: Yangtao Li --- drivers/devfreq/devfreq.c | 33