[PATCH] xen/pcpu: fix possible memory leak in register_pcpu()

2022-11-10 Thread Yang Yingliang
In device_add(), dev_set_name() is called to allocate name, if it returns error, the name need be freed. As comment of device_register() says, it should use put_device() to give up the reference in the error path. So fix this by calling put_device(), then the name can be freed in kobject_cleanup().

Re: [PATCH] xen/pcpu: fix possible memory leak in register_pcpu()

2022-11-10 Thread Juergen Gross
On 10.11.22 16:24, Yang Yingliang wrote: In device_add(), dev_set_name() is called to allocate name, if it returns error, the name need be freed. As comment of device_register() says, it should use put_device() to give up the reference in the error path. So fix this by calling put_device(), then