Skip to content
/ linux Public

Commit 9cb9eca

Browse files
Abdun NihaalSasha Levin
authored andcommitted
media: i2c/tw9903: Fix potential memory leak in tw9903_probe()
[ Upstream commit 9cea16f ] In one of the error paths in tw9903_probe(), the memory allocated in v4l2_ctrl_handler_init() and v4l2_ctrl_new_std() is not freed. Fix that by calling v4l2_ctrl_handler_free() on the handler in that error path. Cc: stable@vger.kernel.org Fixes: 0890ec1 ("[media] tw9903: add new tw9903 video decoder") Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 046c5db commit 9cb9eca

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/media/i2c/tw9903.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ static int tw9903_probe(struct i2c_client *client)
228228

229229
if (write_regs(sd, initial_registers) < 0) {
230230
v4l2_err(client, "error initializing TW9903\n");
231+
v4l2_ctrl_handler_free(hdl);
231232
return -EINVAL;
232233
}
233234

0 commit comments

Comments
 (0)