mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
iio: dummy_evgen: fix possible memleak in evgen init
The memory allocated in the function iio_dummy_evgen_create is not released if it fails to add the evgen device to device hierarchy. This may result in a memory leak bug. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
ce7afa5c56
commit
dfd4f64976
@ -196,7 +196,10 @@ static __init int iio_dummy_evgen_init(void)
|
||||
return ret;
|
||||
device_initialize(&iio_evgen_dev);
|
||||
dev_set_name(&iio_evgen_dev, "iio_evgen");
|
||||
return device_add(&iio_evgen_dev);
|
||||
ret = device_add(&iio_evgen_dev);
|
||||
if (ret)
|
||||
put_device(&iio_evgen_dev);
|
||||
return ret;
|
||||
}
|
||||
module_init(iio_dummy_evgen_init);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user