mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 03:50:24 +09:00
media: ir_toy: fix a memleak in irtoy_tx
[ Upstream commit dc9ceb90c4b42c6e5c6757df1d6257110433788e ]
When irtoy_command fails, buf should be freed since it is allocated by
irtoy_tx, or there is a memleak.
Fixes: 4114978dcd ("media: ir_toy: prevent device from hanging during transmit")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
88936ceab6
commit
207557e393
@@ -324,6 +324,7 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count)
|
||||
sizeof(COMMAND_SMODE_EXIT), STATE_RESET);
|
||||
if (err) {
|
||||
dev_err(irtoy->dev, "exit sample mode: %d\n", err);
|
||||
kfree(buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -331,6 +332,7 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count)
|
||||
sizeof(COMMAND_SMODE_ENTER), STATE_COMMAND);
|
||||
if (err) {
|
||||
dev_err(irtoy->dev, "enter sample mode: %d\n", err);
|
||||
kfree(buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user