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)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 5 Feb 2024 11:57:45 +0000 (12:57 +0100)
commit8cf9c5051076e0eb958f4361d50d8b0c3ee6691c
tree6fb1a8ca227e5d1169755ad3a49c7aabb6e89e5e
parent6c1a584a15d6ee35fa3448b84379150b401eb148
media: v4l2-tpg: fix some memleaks in tpg_alloc

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>
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c