Hello,
It seems to me there is a memory leak in the implementation of gb_svc_create(). In the error handling path (labeled as err_put_device) the code correctly puts svc->dev, but I am suspicious that svc->wq is leaking. The allocated svc->wq needs a release via destroy_workqueue() in the error handling path. Am I missing something?
Thank you,
On Sat, Dec 14, 2019 at 05:44:05PM -0600, Navid Emamdoost wrote:
Hello,
It seems to me there is a memory leak in the implementation of gb_svc_create(). In the error handling path (labeled as err_put_device) the code correctly puts svc->dev, but I am suspicious that svc->wq is leaking. The allocated svc->wq needs a release via destroy_workqueue() in the error handling path. Am I missing something?
You are. Just grep for destroy_workqueue() in that file to see where svc->wc is freed (and that function is called on final put_device()).
Johan
Got it! Thanks for clarifying.
On Sun, Dec 15, 2019 at 7:13 AM Johan Hovold johan@kernel.org wrote:
On Sat, Dec 14, 2019 at 05:44:05PM -0600, Navid Emamdoost wrote:
Hello,
It seems to me there is a memory leak in the implementation of gb_svc_create(). In the error handling path (labeled as err_put_device) the code correctly puts svc->dev, but I am suspicious that svc->wq is leaking. The allocated svc->wq needs a release via destroy_workqueue() in the error handling path. Am I missing something?
You are. Just grep for destroy_workqueue() in that file to see where svc->wc is freed (and that function is called on final put_device()).
Johan