mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 23:14:31 +08:00
media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity
The entity->name (i.e. name) is allocated in v4l2_m2m_register_entity
but isn't freed in its following error-handling paths. This patch
adds such deallocation to prevent memleak of entity->name.
Fixes: be2fff6563
("media: add helpers for memory-to-memory media controller")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
8cf9c50510
commit
8f94b49a5b
@ -1087,11 +1087,17 @@ static int v4l2_m2m_register_entity(struct media_device *mdev,
|
||||
entity->function = function;
|
||||
|
||||
ret = media_entity_pads_init(entity, num_pads, pads);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
kfree(entity->name);
|
||||
entity->name = NULL;
|
||||
return ret;
|
||||
}
|
||||
ret = media_device_register_entity(mdev, entity);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
kfree(entity->name);
|
||||
entity->name = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user