mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 07:10:27 +00:00
media: ir_toy: fix a memleak in irtoy_tx
When irtoy_command fails, buf should be freed since it is allocated by irtoy_tx, or there is a memleak. Fixes: 4114978dcd24 ("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>
This commit is contained in:
parent
6a9d552483
commit
dc9ceb90c4
@ -332,6 +332,7 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count)
|
|||||||
sizeof(COMMAND_SMODE_EXIT), STATE_COMMAND_NO_RESP);
|
sizeof(COMMAND_SMODE_EXIT), STATE_COMMAND_NO_RESP);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(irtoy->dev, "exit sample mode: %d\n", err);
|
dev_err(irtoy->dev, "exit sample mode: %d\n", err);
|
||||||
|
kfree(buf);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,6 +340,7 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count)
|
|||||||
sizeof(COMMAND_SMODE_ENTER), STATE_COMMAND);
|
sizeof(COMMAND_SMODE_ENTER), STATE_COMMAND);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(irtoy->dev, "enter sample mode: %d\n", err);
|
dev_err(irtoy->dev, "enter sample mode: %d\n", err);
|
||||||
|
kfree(buf);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user