media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity
authorZhipeng Lu <alexious@zju.edu.cn>
Thu, 1 Feb 2024 12:48:44 +0000 (20:48 +0800)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 5 Feb 2024 11:57:45 +0000 (12:57 +0100)
commit8f94b49a5b5d386c038e355bef6347298aabd211
tree439e402ede8fff0574f82518b62ed7fec6ca0d8e
parent8cf9c5051076e0eb958f4361d50d8b0c3ee6691c
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: be2fff656322 ("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>
drivers/media/v4l2-core/v4l2-mem2mem.c