]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: dvb-usb: m920x: Fix a potential memory leak in m920x_i2c_xfer()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 29 May 2023 05:58:36 +0000 (07:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:22:44 +0000 (12:22 +0200)
commit7ca7cd02114ac8caa6b0a64734b9af6be1559353
tree71190d56e0a536972c28447693b3cf8dd3e2252b
parentfb24b65aaccd99707a8b7bd439b46dbcbd6b36d3
media: dvb-usb: m920x: Fix a potential memory leak in m920x_i2c_xfer()

[ Upstream commit ea9ef6c2e001c5dc94bee35ebd1c8a98621cf7b8 ]

'read' is freed when it is known to be NULL, but not when a read error
occurs.

Revert the logic to avoid a small leak, should a m920x_read() call fail.

Fixes: a2ab06d7c4d6 ("media: m920x: don't use stack on USB reads")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/dvb-usb/m920x.c