]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: v4l2-tpg: fix some memleaks in tpg_alloc
authorZhipeng Lu <alexious@zju.edu.cn>
Thu, 1 Feb 2024 12:47:53 +0000 (20:47 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:45 +0000 (18:19 -0400)
commit4c86c772fef06f5d7a66151bac42366825db0941
tree75caf3e3771bfec0d1447274ba17b259aa427ba7
parentb64cc91c6d763d73f2fed929f666cd7774bed36f
media: v4l2-tpg: fix some memleaks in tpg_alloc

[ Upstream commit 8cf9c5051076e0eb958f4361d50d8b0c3ee6691c ]

In tpg_alloc, resources should be deallocated in each and every
error-handling paths, since they are allocated in for statements.
Otherwise there would be memleaks because tpg_free is called only when
tpg_alloc return 0.

Fixes: 63881df94d3e ("[media] vivid: add the Test Pattern Generator")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c