media: media/saa7164: fix saa7164_encoder_register() memory leak bugs
authorDaniel Niv <danielniv3@gmail.com>
Thu, 11 Mar 2021 02:53:00 +0000 (03:53 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 22 Mar 2021 10:53:03 +0000 (11:53 +0100)
commitc759b2970c561e3b56aa030deb13db104262adfe
tree5299aabf6eb1a905eeb3faa3c165675cd4698636
parentaa966274d62957c67126c28433e5a5e188516d3c
media: media/saa7164: fix saa7164_encoder_register() memory leak bugs

Add a fix for the memory leak bugs that can occur when the
saa7164_encoder_register() function fails.
The function allocates memory without explicitly freeing
it when errors occur.
Add a better error handling that deallocate the unused buffers before the
function exits during a fail.

Signed-off-by: Daniel Niv <danielniv3@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/pci/saa7164/saa7164-encoder.c