media: i2c: hi846: Fix memory leak in hi846_parse_dt()
authorRafael Mendonca <rafaelmendsr@gmail.com>
Mon, 19 Sep 2022 02:12:51 +0000 (23:12 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:04 +0000 (13:32 +0100)
commit4368730678412a8fa71960dbda81e122dafa70f7
treee54800b33fc103e5e9b7fbcb489f9c2e79010351
parent5459eaca151dcf1a31fd54a4ce8a874c9ebce1ca
media: i2c: hi846: Fix memory leak in hi846_parse_dt()

[ Upstream commit 80113026d415e27483669db7a88b548d1ec3d3d1 ]

If any of the checks related to the supported link frequencies fail, then
the V4L2 fwnode resources don't get released before returning, which leads
to a memleak. Fix this by properly freeing the V4L2 fwnode data in a
designated label.

Fixes: e8c0882685f9 ("media: i2c: add driver for the SK Hynix Hi-846 8M pixel camera")
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
Reviewed-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/i2c/hi846.c